home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / cc / g++-dist / integrate.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-03-09  |  73.8 KB  |  2,521 lines

  1. /* Procedure integration for GNU CC.
  2.    Copyright (C) 1988 Free Software Foundation, Inc.
  3.    Contributed by Michael Tiemann (tiemann@mcc.com)
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 1, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21.  
  22. #include <stdio.h>
  23.  
  24. #include "config.h"
  25. #include "rtl.h"
  26. #include "tree.h"
  27. #include "flags.h"
  28. #include "insn-flags.h"
  29. #include "expr.h"
  30.  
  31. #include "obstack.h"
  32. #define    obstack_chunk_alloc    xmalloc
  33. #define    obstack_chunk_free    free
  34. extern int xmalloc ();
  35. extern void free ();
  36.  
  37. extern struct obstack permanent_obstack, maybepermanent_obstack;
  38. extern struct obstack *rtl_obstack, *saveable_obstack, *current_obstack;
  39.  
  40. extern rtx stack_slot_list;
  41.  
  42. #define MIN(x,y) ((x < y) ? x : y)
  43.  
  44. extern tree pushdecl ();
  45. extern tree poplevel ();
  46.  
  47. /* Default max number of insns a function can have and still be inline.
  48.    This is overridden on RISC machines.  */
  49. #ifndef INTEGRATE_THRESHOLD
  50. #define INTEGRATE_THRESHOLD(DECL) \
  51.   (8 * (8 + list_length (DECL_ARGUMENTS (DECL)) + 16*TREE_INLINE (DECL)))
  52. #endif
  53.  
  54. /* This is the target of the inline function being expanded,
  55.    or NULL if there is none.  */
  56. static rtx inline_target;
  57.  
  58. /* We must take special care not to disrupt life too severely
  59.    when performing procedure integration.  One thing that that
  60.    involves is not creating illegitimate address which reload
  61.    cannot fix.  Since we don't know what the frame pointer is
  62.    not capable of (in a machine independent way), we create
  63.    a pseudo-frame pointer which will have to do for now.  */
  64. static rtx before_inline_fp_rtx, inline_fp_rtx;
  65.  
  66. /* Convert old frame-pointer offsets to new.  Parameters which only
  67.    produce values (no addresses, and are never assigned), map directly
  68.    to the pseudo-reg of the incoming value.  Parameters that are
  69.    assigned to but do not have their address taken are given a fresh
  70.    pseudo-register.  Parameters that have their address take are
  71.    given a fresh stack-slot.  */
  72. static rtx *parm_map;
  73.  
  74. /* ?? Should this be done here??  It is not right now.
  75.    Keep track of whether a given pseudo-register is the sum
  76.    of the frame pointer and a const_int (or zero).  */
  77. static char *fp_addr_p;
  78.  
  79. /* For the local variables of the procdure being integrated that live
  80.    on the frame, FRAME_POINTER_DELTA says how much to change their
  81.    offsets by, so that they now live in the correct place on the
  82.    frame of the function being compiled.  */
  83. static int fp_delta;
  84.  
  85. /* When an insn is being copied by copy_rtx_and_substitute,
  86.    this is nonzero if we have copied an ASM_OPERANDS.
  87.    In that case, it is the original input-operand vector.
  88.    Likewise in copy_for_inline.  */
  89. static rtvec orig_asm_operands_vector;
  90.  
  91. /* When an insn is being copied by copy_rtx_and_substitute,
  92.    this is nonzero if we have copied an ASM_OPERANDS.
  93.    In that case, it is the copied input-operand vector.
  94.    Likewise in copy_for_inline.  */
  95. static rtvec copy_asm_operands_vector;
  96.  
  97. /* Likewise, this is the copied constraints vector.  */
  98. static rtvec copy_asm_constraints_vector;
  99.  
  100. /* In save_for_inline, nonzero if past the parm-initialization insns.  */
  101. static int in_nonparm_insns;
  102.  
  103. /* Return a copy of an rtx (as needed), substituting pseudo-register,
  104.    labels, and frame-pointer offsets as necessary.  */
  105. static rtx copy_rtx_and_substitute ();
  106. /* Variant, used for memory addresses that are not memory_address_p.  */
  107. static rtx copy_address ();
  108.  
  109. /* Return the rtx corresponding to a given index in the stack arguments.  */
  110. static rtx access_parm_map ();
  111.  
  112. static void copy_parm_decls ();
  113. static void copy_decl_tree ();
  114.  
  115. static rtx try_fold_cc0 ();
  116.  
  117. /* We do some simple constant folding optimization.  This optimization
  118.    really exists primarily to save time inlining a function.  It
  119.    also helps users who ask for inline functions without -O.  */
  120. static rtx fold_out_const_cc0 ();
  121.  
  122. /* Zero if the current function (whose FUNCTION_DECL is FNDECL)
  123.    is safe and reasonable to integrate into other functions.
  124.    Nonzero means value is a warning message with a single %s
  125.    for the function's name.  */
  126.  
  127. char *
  128. function_cannot_inline_p (fndecl)
  129.      register tree fndecl;
  130. {
  131.   register rtx insn;
  132.   tree last = tree_last (TYPE_ARG_TYPES (TREE_TYPE (fndecl)));
  133.   int max_insns = INTEGRATE_THRESHOLD (fndecl);
  134.   register int ninsns = 0;
  135.   register tree parms;
  136.  
  137.   /* No inlines with varargs.  `grokdeclarator' gives a warning
  138.      message about that if `inline' is specified.  This code
  139.      it put in to catch the volunteers.  */
  140.   if (last && TREE_VALUE (last) != void_type_node)
  141.     return "varargs function cannot be inline";
  142.  
  143.   /* If its not even close, don't even look.  */
  144.   if (get_max_uid () > 4 * max_insns)
  145.     return "function too large to be inline";
  146.  
  147.   /* Don't inline functions with large stack usage,
  148.      since they can make other recursive functions burn up stack.  */
  149.   if (!TREE_INLINE (fndecl) && get_frame_size () > 100)
  150.     return "function stack frame for inlining";
  151.  
  152.   /* We can't inline functions that return structures
  153.      the old-fashioned PCC way, copying into a static block.  */
  154. #ifdef PCC_STATIC_STRUCT_RETURN
  155.   if (flag_pcc_struct_return
  156.       && (TYPE_MODE (TREE_TYPE (TREE_TYPE (fndecl))) == BLKmode
  157.       || RETURN_IN_MEMORY (TREE_TYPE (TREE_TYPE (fndecl)))))
  158.     return "inline functions not supported for this return value type";
  159. #endif
  160.  
  161.   /* Don't inline functions which have BLKmode arguments.
  162.      Don't inline functions that take the address of
  163.        a parameter and do not specify a function prototype.  */
  164.   for (parms = DECL_ARGUMENTS (fndecl); parms; parms = TREE_CHAIN (parms))
  165.     {
  166.       if (TYPE_MODE (TREE_TYPE (parms)) == BLKmode)
  167.     {
  168. #if 0
  169.       return "function with large aggregate parameter cannot be inline";
  170. #else
  171.       TREE_ADDRESSABLE (parms) = 1;
  172. #endif
  173.     }
  174.       if (last == NULL_TREE && TREE_ADDRESSABLE (parms))
  175.     return "no prototype, and parameter address used; cannot be inline";
  176. #if 0
  177.       /* If an aggregate is thought of as "in memory"
  178.      then its components are referred to by narrower memory refs.
  179.      If the actual parameter is a reg, these refs can't be translated,
  180.      esp. since copy_rtx_and_substitute doesn't know whether it is
  181.      reading or writing.  */
  182.       if ((TREE_CODE (TREE_TYPE (parms)) == RECORD_TYPE
  183.        || TREE_CODE (TREE_TYPE (parms)) == UNION_TYPE)
  184.       && GET_CODE (DECL_RTL (parms)) == MEM)
  185.     return "address of an aggregate parameter is used; cannot be inline";
  186. #endif
  187.     }
  188.  
  189.   if (get_max_uid () > max_insns)
  190.     {
  191.       for (ninsns = 0, insn = get_first_nonparm_insn (); insn && ninsns < max_insns;
  192.        insn = NEXT_INSN (insn))
  193.     {
  194.       if (GET_CODE (insn) == INSN
  195.           || GET_CODE (insn) == JUMP_INSN
  196.           || GET_CODE (insn) == CALL_INSN)
  197.         ninsns++;
  198.     }
  199.  
  200.       if (ninsns >= max_insns)
  201.     return "function too large to be inline";
  202.     }
  203.  
  204.   return 0;
  205. }
  206.  
  207. /* Variables used within save_for_inline.  */
  208.  
  209. /* Mapping from old pesudo-register to new pseudo-registers.
  210.    The first element of this map is reg_map[FIRST_PSEUDO_REGISTER].
  211.    It is allocated in `save_for_inline' and `expand_inline_function',
  212.    and deallocated on exit from each of those routines.  */
  213. static rtx *reg_map;
  214.  
  215. /* Mapping from old code-labels to new code-labels.
  216.    The first element of this map is label_map[min_labelno].
  217.    It is allocated in `save_for_inline' and `expand_inline_function',
  218.    and deallocated on exit from each of those routines.  */
  219. static rtx *label_map;
  220.  
  221. /* Mapping from old insn uid's to copied insns.
  222.    It is allocated in `save_for_inline' and `expand_inline_function',
  223.    and deallocated on exit from each of those routines.  */
  224. static rtx *insn_map;
  225.  
  226. /* Map pseudo reg number into the PARM_DECL for the parm living in the reg.
  227.    Zero for a reg that isn't a parm's home.
  228.    Only reg numbers less than max_parm_reg are mapped here.  */
  229. static tree *parmdecl_map;
  230.  
  231. /* Map pseudo reg number to equivalent constant.  We cannot in general
  232.    substitute constants into parameter pseudo registers, since a
  233.    machine descriptions (the Sparc md, maybe others) won't always handle
  234.    the resulting insns.  So if an incoming parameter has a constant
  235.    equivalent, we record it here, and if the resulting insn is
  236.    recognizable, we go with it.  */
  237. static rtx *const_equiv_map;
  238.  
  239. /* Nonzero if we should try using a constant equivalent.
  240.    Set to zero if constant equivalent resulted in insn which could
  241.    not be recognized.  */
  242. static int try_use_const;
  243.  
  244. /* Use "iteration numbering" to speedily pull constant values
  245.    from registers when testing conditionals.  */
  246. static unsigned int *const_age_map, const_age;
  247.  
  248. /* Cleared before attempting to inline any functions.
  249.    Set when const equiv is used.  Used to test whether insn
  250.    is safe for md or not.  */
  251. static int used_const_equiv;
  252.  
  253. /* Keep track of first pseudo-register beyond those that are parms.  */
  254. static int max_parm_reg;
  255.  
  256. /* Offset from arg ptr to the first parm of this inline function.  */
  257. static int first_parm_offset;
  258.  
  259. /* On machines that perform a function return with a single
  260.    instruction, such as the VAX, these return insns must be
  261.    mapped into branch statements.  */
  262. extern rtx return_label;
  263.  
  264. /* Save any constant pool constants in an insn.  */
  265. static void save_constants ();
  266.  
  267. /* Copy an rtx for save_for_inline.  */
  268. static rtx copy_for_inline ();
  269.  
  270. /* Make the insns and PARM_DECLs of the current function permanent
  271.    and record other information in DECL_SAVED_INSNS to allow inlining
  272.    of this function in subsequent calls.  */
  273.  
  274. void
  275. save_for_inline (fndecl)
  276.      tree fndecl;
  277. {
  278.   extern rtx *regno_reg_rtx;    /* in emit-rtl.c.  */
  279.   extern current_function_args_size;
  280.  
  281.   rtx first_insn, last_insn, insn;
  282.   rtx head, copy;
  283.   tree parms;
  284.   int max_labelno, min_labelno, i, len;
  285.   int max_reg;
  286.   int max_uid;
  287.   rtx first_nonparm_insn;
  288.  
  289.   /* Make and emit a return-label if we have not already done so.  */
  290.  
  291.   if (return_label == 0)
  292.     {
  293.       return_label = gen_label_rtx ();
  294.       emit_label (return_label);
  295.     }
  296.  
  297.   /* Get some bounds on the labels and registers used.  */
  298.  
  299.   max_labelno = max_label_num ();
  300.   min_labelno = get_first_label_num ();
  301.   max_parm_reg = max_parm_reg_num ();
  302.   max_reg = max_reg_num ();
  303.  
  304.   /* Set up PARMDECL_MAP which maps pseudo-reg number to its PARM_DECL.
  305.  
  306.      Set TREE_VOLATILE to 0 if the parm is in a register, otherwise 1.
  307.      Later we set TREE_READONLY to 0 if the parm is modified inside the fn.  */
  308.  
  309.   parmdecl_map = (tree *) alloca (max_parm_reg * sizeof (tree));
  310.   bzero (parmdecl_map, max_parm_reg * sizeof (tree));
  311.  
  312.   for (parms = DECL_ARGUMENTS (fndecl); parms; parms = TREE_CHAIN (parms))
  313.     {
  314.       rtx p = DECL_RTL (parms);
  315.  
  316.       if (GET_CODE (p) == REG)
  317.     {
  318.       parmdecl_map[REGNO (p)] = parms;
  319.       TREE_VOLATILE (parms) = 0;
  320.     }
  321.       else
  322.     TREE_VOLATILE (parms) = 1;
  323.       TREE_READONLY (parms) = 1;
  324.     }
  325.  
  326.   /* Replace any constant pool references with the actual constant.  We will
  327.      put the constant back in the copy made below.  */
  328.   for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
  329.     if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
  330.     || GET_CODE (insn) == CALL_INSN)
  331.       save_constants (PATTERN (insn));
  332.  
  333.   /* The list of DECL_SAVES_INSNS, starts off with a header which
  334.      contains the following information:
  335.  
  336.      the first insn of the function (not including the insns that copy
  337.      parameters into registers).
  338.      the first parameter insn of the function,
  339.      the first label used by that function,
  340.      the last label used by that function,
  341.      the highest register number used for parameters,
  342.      the total number of registers used,
  343.      the stack slot list,
  344.      @@ not yet: and some flags that are used to restore compiler globals.  */
  345.  
  346.   head = gen_inline_header_rtx (NULL, NULL, min_labelno, max_labelno,
  347.                 max_parm_reg, max_reg,
  348.                 current_function_args_size, stack_slot_list);
  349.   max_uid = INSN_UID (head);
  350.  
  351.   /* We have now allocated all that needs to be allocated permanently
  352.      on the rtx obstack.  Set our high-water mark, so that we
  353.      can free the rest of this when the time comes.  */
  354.  
  355.   preserve_data ();
  356.  
  357.   /* Copy the chain insns of this function.
  358.      Install the copied chain as the insns of this function,
  359.      for continued compilation;
  360.      the original chain is recorded as the DECL_SAVED_INSNS
  361.      for inlining future calls.  */
  362.  
  363.   /* If there are insns that copy parms from the stack into pseudo registers,
  364.      those insns are not copied.  `expand_inline_function' must
  365.      emit the correct code to handle such things.  */
  366.  
  367.   insn = get_insns ();
  368.   if (GET_CODE (insn) != NOTE)
  369.     abort ();
  370.   first_insn = rtx_alloc (NOTE);
  371.   NOTE_SOURCE_FILE (first_insn) = NOTE_SOURCE_FILE (insn);
  372.   NOTE_LINE_NUMBER (first_insn) = NOTE_LINE_NUMBER (insn);
  373.   INSN_UID (first_insn) = INSN_UID (insn);
  374.   PREV_INSN (first_insn) = NULL;
  375.   NEXT_INSN (first_insn) = NULL;
  376.   last_insn = first_insn;
  377.  
  378.   /* Each pseudo-reg in the old insn chain must have a unique rtx in the copy.
  379.      Make these new rtx's now, and install them in regno_reg_rtx, so they
  380.      will be the official pseudo-reg rtx's for the rest of compilation.  */
  381.  
  382.   reg_map = (rtx *) alloca ((max_reg + 1) * sizeof (rtx));
  383.  
  384.   len = sizeof (struct rtx_def) + (GET_RTX_LENGTH (REG) - 1) * sizeof (rtunion);
  385.   for (i = max_reg - 1; i >= FIRST_PSEUDO_REGISTER; i--)
  386.     reg_map[i] = (rtx)obstack_copy (&maybepermanent_obstack, regno_reg_rtx[i], len);
  387.   bcopy (reg_map + FIRST_PSEUDO_REGISTER,
  388.      regno_reg_rtx + FIRST_PSEUDO_REGISTER,
  389.      (max_reg - FIRST_PSEUDO_REGISTER) * sizeof (rtx));
  390.  
  391.   /* Likewise each label rtx must have a unique rtx as its copy.  */
  392.  
  393.   label_map = (rtx *)alloca ((max_labelno - min_labelno) * sizeof (rtx));
  394.   label_map -= min_labelno;
  395.  
  396.   for (i = min_labelno; i < max_labelno; i++)
  397.     label_map[i] = gen_label_rtx ();
  398.  
  399.   /* Record the mapping of old insns to copied insns.  */
  400.  
  401.   insn_map = (rtx *) alloca (max_uid * sizeof (rtx));
  402.   bzero (insn_map, max_uid * sizeof (rtx));
  403.  
  404.   in_nonparm_insns = 0;
  405.   first_nonparm_insn = get_first_nonparm_insn ();
  406.  
  407.   /* Now copy the chain of insns.  */
  408.  
  409.   for (insn = NEXT_INSN (insn); insn; insn = NEXT_INSN (insn))
  410.     {
  411.       orig_asm_operands_vector = 0;
  412.       copy_asm_operands_vector = 0;
  413.  
  414.       if (insn == first_nonparm_insn)
  415.     in_nonparm_insns = 1;
  416.  
  417.       switch (GET_CODE (insn))
  418.     {
  419.     case NOTE:
  420.       /* No need to keep these.  */
  421.       if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED)
  422.         continue;
  423.  
  424.       copy = rtx_alloc (NOTE);
  425.       NOTE_SOURCE_FILE (copy) = NOTE_SOURCE_FILE (insn);
  426.       NOTE_LINE_NUMBER (copy) = NOTE_LINE_NUMBER (insn);
  427.       break;
  428.  
  429.     case INSN:
  430.     case CALL_INSN:
  431.     case JUMP_INSN:
  432.       copy = rtx_alloc (GET_CODE (insn));
  433.       PATTERN (copy) = copy_for_inline (PATTERN (insn));
  434.       INSN_CODE (copy) = -1;
  435.       LOG_LINKS (copy) = NULL;
  436.       REG_NOTES (copy) = copy_for_inline (REG_NOTES (insn));
  437.       RTX_INTEGRATED_P (copy) = RTX_INTEGRATED_P (insn);
  438.       break;
  439.  
  440.     case CODE_LABEL:
  441.       copy = label_map[CODE_LABEL_NUMBER (insn)];
  442.       break;
  443.  
  444.     case BARRIER:
  445.       copy = rtx_alloc (BARRIER);
  446.       break;
  447.  
  448.     default:
  449.       abort ();
  450.     }
  451.       INSN_UID (copy) = INSN_UID (insn);
  452.       insn_map[INSN_UID (insn)] = copy;
  453.       NEXT_INSN (last_insn) = copy;
  454.       PREV_INSN (copy) = last_insn;
  455.       last_insn = copy;
  456.     }
  457.  
  458.   NEXT_INSN (last_insn) = NULL;
  459.  
  460.   NEXT_INSN (head) = get_first_nonparm_insn ();
  461.   FIRST_PARM_INSN (head) = get_insns ();
  462.   DECL_SAVED_INSNS (fndecl) = head;
  463.   DECL_FRAME_SIZE (fndecl) = get_frame_size ();
  464.   TREE_INLINE (fndecl) = 1;
  465.  
  466.   parmdecl_map = 0;
  467.   label_map = 0;
  468.   reg_map = 0;
  469.   return_label = 0;
  470.  
  471.   set_new_first_and_last_insn (first_insn, last_insn);
  472.  
  473.   /* The following code does not need preprocessing in the assembler.  */
  474.  
  475.   app_disable ();
  476.  
  477.   output_constant_pool (XSTR (XEXP (DECL_RTL (fndecl), 0), 0), fndecl);
  478. }
  479.  
  480. /* References to the constant pool are replaced by the actual constant
  481.     encapsulated with a CONST giving the mode and with RTX_INTEGRATED_P set.
  482.  
  483.    *** Note that the above only works if the address was not manipulated.
  484.        If the address was not valid and had to be loaded into a register,
  485.        we lose track of the fact that it was in the constant pool, which will
  486.        result in either an abort or generating a reference to an undefined
  487.        label in the assembler code.  No current machine will run into this, but
  488.        this should probably be fixed someday.  */
  489.  
  490. static void
  491. save_constants (x)
  492.      rtx x;
  493. {
  494.   int i, j;
  495.   char *fmt = GET_RTX_FORMAT (GET_CODE (x));
  496.  
  497.   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (x)); i++)
  498.     {
  499.       switch (*fmt++)
  500.     {
  501.     case 'E':
  502.       for (j = 0; j < XVECLEN (x, i); j++)
  503.         if (GET_CODE (XVECEXP (x, i, j)) == MEM
  504.         && GET_CODE (XEXP (XVECEXP (x, i, j), 0)) == SYMBOL_REF
  505.         && CONSTANT_POOL_ADDRESS_P (XEXP (XVECEXP (x, i, j), 0)))
  506.           {
  507.         XVECEXP (x, i, j) =
  508.           gen_rtx (CONST, get_pool_mode (XEXP (XVECEXP (x, i, j), 0)),
  509.                get_pool_constant (XEXP (XVECEXP (x, i, j), 0)));
  510.         RTX_INTEGRATED_P (XVECEXP (x, i, j)) = 1;
  511.           }
  512.       else
  513.         save_constants (XVECEXP (x, i, j));
  514.       break;
  515.  
  516.     case 'e':
  517.         if (GET_CODE (XEXP (x, i)) == MEM
  518.         && GET_CODE (XEXP (XEXP (x, i), 0)) == SYMBOL_REF
  519.         && CONSTANT_POOL_ADDRESS_P (XEXP (XEXP (x, i), 0)))
  520.           {
  521.         XEXP (x, i) = gen_rtx (CONST,
  522.                        get_pool_mode (XEXP (XEXP (x, i), 0)),
  523.                        get_pool_constant (XEXP (XEXP (x, i), 0)));
  524.         RTX_INTEGRATED_P (XEXP (x, i)) = 1;
  525.           }
  526.       else
  527.         save_constants (XEXP (x, i));
  528.       break;
  529.     }
  530.     }
  531. }
  532.  
  533. /* Copy the rtx ORIG recursively, replacing pseudo-regs and labels
  534.    according to `reg_map' and `label_map'.
  535.  
  536.    If we find a saved constant pool entry, replace it with the constant.
  537.    Since the pool wasn't touched, this should simply restore the old
  538.    address.
  539.  
  540.    All other kinds of rtx are copied except those that can never be
  541.    changed during compilation.  */
  542.  
  543. static rtx
  544. copy_for_inline (orig)
  545.      rtx orig;
  546. {
  547.   register rtx x = orig;
  548.   register int i;
  549.   register enum rtx_code code;
  550.   register char *format_ptr;
  551.  
  552.   if (x == 0)
  553.     return x;
  554.  
  555.   code = GET_CODE (x);
  556.  
  557.   /* These types may be freely shared.  */
  558.  
  559.   switch (code)
  560.     {
  561.     case QUEUED:
  562.     case CONST_INT:
  563.     case CONST_DOUBLE:
  564.     case SYMBOL_REF:
  565.     case PC:
  566.     case CC0:
  567.       return x;
  568.  
  569.     case CONST:
  570.       /* Get constant pool entry for constant in the pool.  */
  571.       if (RTX_INTEGRATED_P (x))
  572.     return force_const_mem (GET_MODE (x), XEXP (x, 0));
  573.       break;
  574.  
  575.     case ASM_OPERANDS:
  576.       /* If a single asm insn contains multiple output operands
  577.      then it contains multiple ASM_OPERANDS rtx's that share operand 3.
  578.      We must make sure that the copied insn continues to share it.  */
  579.       if (orig_asm_operands_vector == XVEC (orig, 3))
  580.     {
  581.       x = rtx_alloc (ASM_OPERANDS);
  582.       XSTR (x, 0) = XSTR (orig, 0);
  583.       XSTR (x, 1) = XSTR (orig, 1);
  584.       XINT (x, 2) = XINT (orig, 2);
  585.       XVEC (x, 3) = copy_asm_operands_vector;
  586.       XVEC (x, 4) = copy_asm_constraints_vector;
  587.       XSTR (x, 5) = XSTR (orig, 5);
  588.       XINT (x, 6) = XINT (orig, 6);
  589.       return x;
  590.     }
  591.       break;
  592.  
  593.     case MEM:
  594.       /* A MEM is allowed to be shared if its address is constant
  595.      or is a constant plus one of the special registers.  */
  596.       if (CONSTANT_ADDRESS_P (XEXP (x, 0)))
  597.     return x;
  598. #if 0 /* This is turned off because it is possible for
  599.      unshare_all_rtl to copy the address, into memory that won't be saved.
  600.      Although the MEM can safely be shared, and won't be copied there,
  601.      the address itself cannot be shared, and may need to be copied.  */
  602.       if (GET_CODE (XEXP (x, 0)) == PLUS
  603.       && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
  604.       && (REGNO (XEXP (XEXP (x, 0), 0)) == FRAME_POINTER_REGNUM
  605.           || REGNO (XEXP (XEXP (x, 0), 0)) == ARG_POINTER_REGNUM)
  606.       && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1)))
  607. #if 0
  608.     /* This statement was accidentally deleted in the remote past.
  609.        Reinsert it for 1.37.  Don't take the risk now.  */
  610.     return x;
  611. #endif
  612.     if (GET_CODE (XEXP (x, 0)) == REG
  613.         && (REGNO (XEXP (x, 0)) == FRAME_POINTER_REGNUM
  614.         || REGNO (XEXP (x, 0)) == ARG_POINTER_REGNUM)
  615.         && CONSTANT_ADDRESS_P (XEXP (x, 1)))
  616.     return x;
  617. #endif /* 0 */
  618.       break;
  619.  
  620.     case LABEL_REF:
  621.       {
  622.     /* Must point to the new insn.  */
  623.     return gen_rtx (LABEL_REF, GET_MODE (orig),
  624.             label_map[CODE_LABEL_NUMBER (XEXP (orig, 0))]);
  625.       }
  626.  
  627.     case REG:
  628.       if (REGNO (x) >= FIRST_PSEUDO_REGISTER)
  629.     return reg_map [REGNO (x)];
  630.       else
  631.     return x;
  632.  
  633.       /* If a parm that gets modified lives in a pseudo-reg,
  634.      set its TREE_VOLATILE to prevent certain optimizations.  */
  635.     case SET:
  636.       if (in_nonparm_insns)
  637.     {
  638.       rtx dest = SET_DEST (x);
  639.  
  640.       if (GET_CODE (dest) == REG
  641.           && REGNO (dest) < max_parm_reg
  642.           && REGNO (dest) >= FIRST_PSEUDO_REGISTER
  643.           && parmdecl_map[REGNO (dest)] != 0)
  644.         TREE_READONLY (parmdecl_map[REGNO (dest)]) = 0;
  645.     }
  646.       /* The insn to load an arg pseudo from a stack slot
  647.      does not count as modifying it.  */
  648.       break;
  649.  
  650.       /* Arrange that CONST_INTs always appear as the second operand
  651.      if they appear, and that `frame_pointer_rtx' or `arg_pointer_rtx'
  652.      always appear as the first.  */
  653.     case PLUS:
  654.       if (GET_CODE (XEXP (x, 0)) == CONST_INT
  655.       || (XEXP (x, 1) == frame_pointer_rtx
  656.           || (ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
  657.           && XEXP (x, 1) == arg_pointer_rtx)))
  658.     {
  659.       rtx t = XEXP (x, 0);
  660.       XEXP (x, 0) = XEXP (x, 1);
  661.       XEXP (x, 1) = t;
  662.     }
  663.       break;
  664.     }
  665.  
  666.   /* Replace this rtx with a copy of itself.  */
  667.  
  668.   x = rtx_alloc (code);
  669.   bcopy (orig, x, (sizeof (*x) - sizeof (x->fld)
  670.            + sizeof (x->fld[0]) * GET_RTX_LENGTH (code)));
  671.  
  672.   /* Now scan the subexpressions recursively.
  673.      We can store any replaced subexpressions directly into X
  674.      since we know X is not shared!  Any vectors in X
  675.      must be copied if X was copied.  */
  676.  
  677.   format_ptr = GET_RTX_FORMAT (code);
  678.  
  679.   for (i = 0; i < GET_RTX_LENGTH (code); i++)
  680.     {
  681.       switch (*format_ptr++)
  682.     {
  683.     case 'e':
  684.       XEXP (x, i) = copy_for_inline (XEXP (x, i));
  685.       break;
  686.  
  687.     case 'u':
  688.       /* Change any references to old-insns to point to the
  689.          corresponding copied insns.  */
  690.       return insn_map[INSN_UID (XEXP (x, i))];
  691.  
  692.     case 'E':
  693.       if (XVEC (x, i) != NULL && XVECLEN (x, i) != 0)
  694.         {
  695.           register int j;
  696.  
  697.           XVEC (x, i) = gen_rtvec_v (XVECLEN (x, i), &XVECEXP (x, i, 0));
  698.           for (j = 0; j < XVECLEN (x, i); j++)
  699.         XVECEXP (x, i, j)
  700.           = copy_for_inline (XVECEXP (x, i, j));
  701.         }
  702.       break;
  703.     }
  704.     }
  705.  
  706.   if (code == ASM_OPERANDS && orig_asm_operands_vector == 0)
  707.     {
  708.       orig_asm_operands_vector = XVEC (orig, 3);
  709.       copy_asm_operands_vector = XVEC (x, 3);
  710.       copy_asm_constraints_vector = XVEC (x, 4);
  711.     }
  712.  
  713.   return x;
  714. }
  715.  
  716. /* Helper function to deal with using constants for kinds of INSNs.
  717.    Return zero if trouble arose by using constants.
  718.    Return one if not.  Caller must know what to do in either case.  */
  719. static int
  720. note_integrated (copy)
  721.      rtx copy;
  722. {
  723.   if (used_const_equiv)
  724.     {
  725.       used_const_equiv = 0;
  726.       if (recog (PATTERN (copy), copy) < 0)
  727.     {
  728.       int old_optimize = optimize;
  729.       optimize = 1;
  730.       delete_insn (copy);
  731.       optimize = old_optimize;
  732.       try_use_const = 0;
  733.       return 0;
  734.     }
  735.     }
  736.   try_use_const = 1;
  737.   RTX_INTEGRATED_P (copy) = 1;
  738.   return 1;
  739. }
  740.  
  741. /* Integrate the procedure defined by FNDECL.  Note that this function
  742.    may wind up calling itself.  Since the static variables are not
  743.    reentrant, we do not assign them until after the possibility
  744.    or recursion is eliminated.
  745.  
  746.    If IGNORE is nonzero, do not produce a value.
  747.    Otherwise store the value in TARGET if it is nonzero and that is convenient.
  748.  
  749.    Value is:
  750.    (rtx)-1 if we could not substitute the function
  751.    0 if we substituted it and it does not produce a value
  752.    else an rtx for where the value is stored.  */
  753.  
  754. rtx
  755. expand_inline_function (fndecl, parms, target, ignore, type, structure_value_addr)
  756.      tree fndecl, parms;
  757.      rtx target;
  758.      int ignore;
  759.      tree type;
  760.      rtx structure_value_addr;
  761. {
  762.   tree formal, actual;
  763.   rtx header = DECL_SAVED_INSNS (fndecl);
  764.   rtx insns = FIRST_FUNCTION_INSN (header);
  765.   rtx insn;
  766.   int max_regno = MAX_REGNUM (header) + 1;
  767.   register int i;
  768.   int min_labelno = FIRST_LABELNO (header);
  769.   int max_labelno = LAST_LABELNO (header);
  770.   int nargs;
  771.   rtx *arg_vec;
  772.   rtx local_return_label = 0;
  773.   rtx follows_call = 0;
  774.   rtx this_struct_value_rtx = 0;
  775.  
  776.   /* Hack around non-reentrancy of static variables.  */
  777.   rtx *old_const_equiv_map = const_equiv_map;
  778.   unsigned *old_const_age_map = const_age_map;
  779.   unsigned old_const_age = const_age;
  780.  
  781.   /* If we need INLINE_FP_RTX, set it up immediately
  782.      following this insn.  */
  783.  
  784.   if (max_regno < FIRST_PSEUDO_REGISTER)
  785.     abort ();
  786.  
  787.   nargs = list_length (DECL_ARGUMENTS (fndecl));
  788.  
  789.   /* We expect PARMS to have the right length; don't crash if not.  */
  790.   if (list_length (parms) != nargs)
  791.     return (rtx)-1;
  792.  
  793.   /* Also check that the parms type match.  Since the appropriate
  794.      conversions or default promotions have already been applied,
  795.      the machine modes should match exactly.  */
  796.   for (formal = DECL_ARGUMENTS (fndecl),
  797.        actual = parms;
  798.        formal;
  799.        formal = TREE_CHAIN (formal),
  800.        actual = TREE_CHAIN (actual))
  801.     {
  802.       tree arg = TREE_VALUE (actual);
  803.       enum machine_mode mode = TYPE_MODE (DECL_ARG_TYPE (formal));
  804.       if (mode != TYPE_MODE (TREE_TYPE (arg)))
  805.     return (rtx)-1;
  806.       /* If they are block mode, the types should match exactly.
  807.          They don't match exactly if TREE_TYPE (FORMAL) == ERROR_MARK_NODE,
  808.      which could happen if the parameter has incomplete type.  */
  809.       if (mode == BLKmode && TREE_TYPE (arg) != TREE_TYPE (formal))
  810.     return (rtx)-1;
  811.     }
  812.  
  813.   const_equiv_map = (rtx *)alloca (max_regno * sizeof (rtx));
  814.   bzero (const_equiv_map, max_regno * sizeof (rtx));
  815.   const_age_map = (unsigned *)alloca (max_regno * sizeof (unsigned));
  816.   bzero (const_age_map, max_regno * sizeof (unsigned));
  817.   try_use_const = 1;
  818.   /* Trick: set to large number so that variables set in first
  819.      basic block keep their values.  After first label is seen,
  820.      we wrap.  */
  821.   const_age = (unsigned)-1;
  822.  
  823.   /* Make a binding contour to keep inline cleanups called at
  824.      outer function-scope level from looking like they are shadowing
  825.      parameter declarations.  */
  826.   pushlevel (0);
  827.  
  828.   /* Make a fresh binding contour that we can easily remove.  */
  829.   pushlevel (0);
  830.   expand_start_bindings (0);
  831.  
  832.   /* Get all the actual args as RTL, and store them in ARG_VEC.  */
  833.  
  834.   arg_vec = (rtx *)alloca (nargs * sizeof (rtx));
  835.  
  836.   /* Say where this function starts.  */
  837.   emit_note (DECL_SOURCE_FILE (fndecl), DECL_SOURCE_LINE (fndecl));
  838.  
  839.   for (formal = DECL_ARGUMENTS (fndecl),
  840.        actual = parms,
  841.        i = 0;
  842.        formal;
  843.        formal = TREE_CHAIN (formal),
  844.        actual = TREE_CHAIN (actual),
  845.        i++)
  846.     {
  847.       /* Actual parameter, already converted to DECL_ARG_TYPE (formal).  */
  848.       tree arg = TREE_VALUE (actual);
  849.       /* Mode of the value supplied.  */
  850.       enum machine_mode tmode = TYPE_MODE (DECL_ARG_TYPE (formal));
  851.       /* Mode of the variable used within the function.  */
  852.       enum machine_mode imode = TYPE_MODE (TREE_TYPE (formal));
  853.       rtx copy;
  854.  
  855. #if 0
  856.       /* PARM_DECL nodes no longer have this.  */
  857.       emit_note (DECL_SOURCE_FILE (formal), DECL_SOURCE_LINE (formal));
  858. #endif
  859.  
  860.       /* Make a place to hold the argument value, still in mode TMODE,
  861.      and put it in COPY.  */
  862.       if (TREE_ADDRESSABLE (formal))
  863.     {
  864.       int size = int_size_in_bytes (DECL_ARG_TYPE (formal));
  865.       copy = assign_stack_local (tmode, size);
  866.       if (!memory_address_p (DECL_MODE (formal), XEXP (copy, 0)))
  867.         copy = change_address (copy, VOIDmode, copy_rtx (XEXP (copy, 0)));
  868.       store_expr (arg, copy, 0);
  869.     }
  870.       else if (! TREE_READONLY (formal)
  871.            || TREE_VOLATILE (formal))
  872.     {
  873.       /* If parm is modified or if it hasn't a pseudo reg,
  874.          we may not simply substitute the actual value;
  875.          copy it through a register.  */
  876.       copy = gen_reg_rtx (tmode);
  877.       store_expr (arg, copy, 0);
  878.     }
  879.       else
  880.     {
  881.       copy = expand_expr (arg, 0, tmode, 0);
  882.  
  883.       /* We do not use CONSTANT_ADDRESS_P here because
  884.          the set of cases where that might make a difference
  885.          are a subset of the cases that arise even when
  886.          it is a CONSTANT_ADDRESS_P (i.e., fp_delta
  887.          gets into the act.  */
  888.       if (GET_CODE (copy) != REG)
  889.         {
  890. #if 0
  891.           if (! CONSTANT_P (copy))
  892.         copy = copy_to_reg (copy);
  893.           else if (! optimize)
  894.         copy = copy_to_mode_reg (imode, copy);
  895. #else
  896.           /*   Sigh.  */
  897.           if (! CONSTANT_P (copy))
  898.         copy = copy_to_reg (copy);
  899.           else
  900.         {
  901.           if (GET_CODE (DECL_RTL (formal)) == REG)
  902.             {
  903.               int regno = REGNO (DECL_RTL (formal));
  904.               const_equiv_map[regno] = copy;
  905.               const_age_map[regno] = (unsigned)-2;
  906.             }
  907.           copy = copy_to_mode_reg (imode, copy);
  908.         }
  909. #endif
  910.         }
  911.     }
  912.       /* If passed mode != nominal mode, COPY is now the passed mode.
  913.      Convert it to the nominal mode (i.e. truncate it).  */
  914.       if (tmode != imode)
  915.     copy = convert_to_mode (imode, copy, 0);
  916.       arg_vec[i] = copy;
  917.     }
  918.  
  919.   copy_parm_decls (DECL_ARGUMENTS (fndecl), arg_vec);
  920.  
  921.   /* Perform postincrements before actually calling the function.  */
  922.   emit_queue ();
  923.  
  924.   /* clean up stack so that variables might have smaller offsets.  */
  925.   do_pending_stack_adjust ();
  926.  
  927.   /* Pass the function the address in which to return a structure value.
  928.      Note that a constructor can cause someone to call us with
  929.      STRUCTURE_VALUE_ADDR, but the initialization takes place
  930.      via the first parameter, rather than the struct return address.  */
  931.   if (structure_value_addr && aggregate_value_p (DECL_RESULT (fndecl)))
  932.     {
  933.       if (GET_CODE (structure_value_addr) == REG
  934.       && (struct_value_rtx == 0 || GET_CODE (struct_value_rtx) == MEM))
  935.     this_struct_value_rtx = structure_value_addr;
  936.       else
  937.      this_struct_value_rtx = copy_to_mode_reg (Pmode, structure_value_addr);
  938.     }
  939.  
  940.   /* Now prepare for copying the insns.
  941.      Set up reg_map, parm_map and label_map saying how to translate
  942.      the pseudo-registers, stack-parm references and labels when copying.  */
  943.  
  944.   reg_map = (rtx *) alloca (max_regno * sizeof (rtx));
  945.   bzero (reg_map, max_regno * sizeof (rtx));
  946.  
  947.   parm_map = (rtx *)alloca ((FUNCTION_ARGS_SIZE (header) + UNITS_PER_WORD - 1)
  948.                 / UNITS_PER_WORD * sizeof (rtx));
  949.   bzero (parm_map, ((FUNCTION_ARGS_SIZE (header) + UNITS_PER_WORD - 1)
  950.             / UNITS_PER_WORD * sizeof (rtx)));
  951.  
  952.   /* Note that expand_expr (called above) can clobber first_parm_offset.  */
  953.   first_parm_offset = FIRST_PARM_OFFSET (fndecl);
  954.   parm_map -= first_parm_offset / UNITS_PER_WORD;
  955.  
  956.   if (DECL_ARGUMENTS (fndecl))
  957.     {
  958.       tree decl = DECL_ARGUMENTS (fndecl);
  959.  
  960.       for (formal = decl, i = 0; formal; formal = TREE_CHAIN (formal), i++)
  961.     {
  962.       /* Create an entry in PARM_MAP that says what pseudo register
  963.          is associated with an address we might compute.  */
  964.       if (DECL_OFFSET (formal) >= 0)
  965.         {
  966.           /* This parameter has a home in the stack.  */
  967.           parm_map[DECL_OFFSET (formal) / BITS_PER_WORD] = arg_vec[i];
  968.         }
  969.       else
  970.         {
  971.           /* Parameter that was passed in a register;
  972.          does it have a home on the stack (as a local)?  */
  973.           rtx frtx = DECL_RTL (formal);
  974.           rtx offset = 0;
  975.           if (GET_CODE (frtx) == MEM)
  976.         {
  977.           frtx = XEXP (frtx, 0);
  978.           if (GET_CODE (frtx) == PLUS)
  979.             {
  980.               if (XEXP (frtx, 0) == frame_pointer_rtx
  981.               && GET_CODE (XEXP (frtx, 1)) == CONST_INT)
  982.             offset = XEXP (frtx, 1);
  983.               else if (XEXP (frtx, 1) == frame_pointer_rtx
  984.                    && GET_CODE (XEXP (frtx, 0)) == CONST_INT)
  985.             offset = XEXP (frtx, 0);
  986. #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
  987.               /* If there is a separate arg pointer
  988.              and REG_PARM_STACK_SPACE is defined,
  989.              parms passed in regs can be copied
  990.              to slots reached via the arg pointer.  */
  991.               if (XEXP (frtx, 0) == arg_pointer_rtx
  992.               && GET_CODE (XEXP (frtx, 1)) == CONST_INT)
  993.             offset = XEXP (frtx, 1);
  994.               else if (XEXP (frtx, 1) == arg_pointer_rtx
  995.                    && GET_CODE (XEXP (frtx, 0)) == CONST_INT)
  996.             offset = XEXP (frtx, 0);
  997. #endif
  998.             }
  999.           if (offset)
  1000.             parm_map[INTVAL (offset) / UNITS_PER_WORD] = arg_vec[i];
  1001.           else if (TREE_TYPE (formal) != error_mark_node)
  1002.             abort ();
  1003.         }
  1004.           else if (GET_CODE (frtx) != REG)
  1005.         abort ();
  1006.         }
  1007.       /* Create an entry in REG_MAP that says what rtx is associated
  1008.          with a pseudo register from the function being inlined.  */
  1009.       if (GET_CODE (DECL_RTL (formal)) == REG)
  1010.         reg_map[REGNO (DECL_RTL (formal))] = arg_vec[i];
  1011.     }
  1012.     }
  1013.  
  1014.   /* Make certain that we can accept struct_value_{incoming_rtx,rtx},
  1015.      and map it.  */
  1016.   if (this_struct_value_rtx == 0)
  1017.     ;
  1018.   else if (GET_CODE (struct_value_incoming_rtx) == REG)
  1019.     reg_map[REGNO (XEXP (DECL_RTL (DECL_RESULT (fndecl)), 0))]
  1020.       = this_struct_value_rtx;
  1021.   else if (GET_CODE (struct_value_incoming_rtx) == MEM
  1022.        && XEXP (XEXP (struct_value_incoming_rtx, 0), 0) == frame_pointer_rtx
  1023.        && GET_CODE (XEXP (XEXP (struct_value_incoming_rtx, 0), 1)) == CONST_INT)
  1024. #if 1
  1025.     reg_map[REGNO (XEXP (DECL_RTL (DECL_RESULT (fndecl)), 0))]
  1026.       = this_struct_value_rtx;
  1027. #else
  1028.     parm_map[INTVAL (XEXP (XEXP (struct_value_incoming_rtx, 0), 1)) / UNITS_PER_WORD]
  1029.       = this_struct_value_rtx;
  1030. #endif
  1031.   else
  1032.     abort ();
  1033.  
  1034.   label_map = (rtx *)alloca ((max_labelno - min_labelno) * sizeof (rtx));
  1035.   label_map -= min_labelno;
  1036.  
  1037.   for (i = min_labelno; i < max_labelno; i++)
  1038.     label_map[i] = gen_label_rtx ();
  1039.  
  1040.   /* As we copy insns, record the correspondence, so that inter-insn
  1041.      references can be copied into isomorphic structure.  */
  1042.  
  1043.   insn_map = (rtx *) alloca (INSN_UID (header) * sizeof (rtx));
  1044.   bzero (insn_map, INSN_UID (header) * sizeof (rtx));
  1045.  
  1046.   /* Set up a target to translate the inline function's value-register.  */
  1047.  
  1048.   if (structure_value_addr != 0 || TYPE_MODE (type) == VOIDmode)
  1049.     inline_target = 0;
  1050.   else
  1051.     {
  1052.       /* Machine mode function was declared to return.   */
  1053.       enum machine_mode departing_mode = TYPE_MODE (type);
  1054.       /* (Possibly wider) machine mode it actually computes
  1055.      (for the sake of callers that fail to declare it right).  */
  1056.       enum machine_mode arriving_mode
  1057.     = TYPE_MODE (DECL_RESULT_TYPE (fndecl));
  1058.  
  1059.       /* Don't use MEMs as direct targets because on some machines
  1060.      substituting a MEM for a REG makes invalid insns.
  1061.      Let the combiner substitute the MEM if that is valid.  */
  1062.       if (target && GET_CODE (target) == REG
  1063.       && GET_MODE (target) == departing_mode)
  1064.     inline_target = target;
  1065.       else
  1066.     {
  1067.       inline_target = gen_reg_rtx (departing_mode);
  1068.       if (target == 0)
  1069.         target = inline_target;
  1070.     }
  1071.  
  1072.       /* If function's value was promoted before return,
  1073.      avoid machine mode mismatch when we substitute INLINE_TARGET.
  1074.      But TARGET is what we will return to the caller.  */
  1075.       if (arriving_mode != departing_mode)
  1076.     inline_target = gen_rtx (SUBREG, arriving_mode, inline_target, 0);
  1077.     }
  1078.  
  1079.   /* Make space in current function's stack frame
  1080.      for the stack frame of the inline function.
  1081.      Adjust all frame-pointer references by the difference
  1082.      between the offset to this space
  1083.      and the offset to the equivalent space in the inline
  1084.      function's frame.
  1085.      This difference equals the size of preexisting locals.  */
  1086.  
  1087.   fp_delta = get_frame_size ();
  1088. #ifdef FRAME_GROWS_DOWNWARD
  1089.   fp_delta = - fp_delta;
  1090. #endif
  1091.  
  1092.   before_inline_fp_rtx = get_last_insn ();
  1093.   inline_fp_rtx = 0;
  1094.  
  1095.   /* Now allocate the space for that to point at.  */
  1096.  
  1097.   assign_stack_local (VOIDmode, DECL_FRAME_SIZE (fndecl));
  1098.  
  1099.   /* Now copy the insns one by one, except for the first,
  1100.      which is always a NOTE_INSN_DELTED.  */
  1101.  
  1102.   for (insn = insns; insn; insn = NEXT_INSN (insn))
  1103.     {
  1104.       rtx copy, pattern, next = 0;
  1105.  
  1106.     retry:
  1107.       orig_asm_operands_vector = 0;
  1108.       copy_asm_operands_vector = 0;
  1109.  
  1110.       switch (GET_CODE (insn))
  1111.     {
  1112.     case INSN:
  1113.       pattern = PATTERN (insn);
  1114.  
  1115.       /* Special handling for the insn immediately after a CALL_INSN
  1116.          that returned a value:
  1117.          If it does copy the value, we must avoid the usual translation
  1118.          of the return-register into INLINE_TARGET.
  1119.          If it just USEs the value, the inline function expects it to
  1120.          stay in the return-register and be returned,
  1121.          so copy it into INLINE_TARGET.  */
  1122.  
  1123.       if (follows_call
  1124.           /* Allow a stack-adjust, handled normally, to come in between
  1125.          the call and the value-copying insn.  */
  1126.           && ! (GET_CODE (pattern) == SET
  1127.             && SET_DEST (pattern) == stack_pointer_rtx))
  1128.         {
  1129.           if (GET_CODE (pattern) == SET
  1130.           && rtx_equal_p (SET_SRC (pattern), follows_call))
  1131.         /* This insn copies the value: take special care to copy
  1132.            that value to this insn's destination.  */
  1133.         {
  1134.           copy = emit_insn (gen_rtx (SET, VOIDmode,
  1135.                          copy_rtx_and_substitute (SET_DEST (pattern)),
  1136.                          follows_call));
  1137.           if (! note_integrated (copy))
  1138.             {
  1139.               next = 0;
  1140.               goto retry;
  1141.             }
  1142.           follows_call = 0;
  1143.           break;
  1144.         }
  1145.           else if (GET_CODE (pattern) == USE
  1146.                && rtx_equal_p (XEXP (pattern, 0), follows_call))
  1147.         /* This insn does nothing but says the value is expected
  1148.            to flow through to the inline function's return-value.
  1149.            Make that happen, then ignore this insn.  */
  1150.         {
  1151.           copy = emit_insn (gen_rtx (SET, VOIDmode, inline_target,
  1152.                          follows_call));
  1153.           if (! note_integrated (copy))
  1154.             {
  1155.               next = 0;
  1156.               goto retry;
  1157.             }
  1158.           follows_call = 0;
  1159.           break;
  1160.         }
  1161.           /* If it does neither, this value must be ignored.  */
  1162.           follows_call = 0;
  1163.         }
  1164.  
  1165.       copy = 0;
  1166.       if (GET_CODE (pattern) == USE
  1167.           && GET_CODE (XEXP (pattern, 0)) == REG)
  1168.         {
  1169.           /* The (USE (REG n)) at return from the function should
  1170.          be ignored since we are changing (REG n) into
  1171.          inline_target.  */
  1172.           if (! ignore && REG_FUNCTION_VALUE_P (XEXP (pattern, 0)))
  1173.         break;
  1174.           /* Don't emit a (USE (REG n)) of something which
  1175.          is now constant.  */
  1176.           if (REGNO (XEXP (pattern, 0)) >= FIRST_PSEUDO_REGISTER
  1177.           && (const_age == (unsigned)-1
  1178.               || const_age_map[REGNO (XEXP (pattern, 0))] >= const_age))
  1179.         break;
  1180.         }
  1181.  
  1182.       /* Ignore setting a function value that we don't want to use.  */
  1183.       if (inline_target == 0
  1184.           && GET_CODE (pattern) == SET
  1185.           && GET_CODE (SET_DEST (pattern)) == REG
  1186.           && REG_FUNCTION_VALUE_P (SET_DEST (pattern)))
  1187.         break;
  1188.  
  1189.       /* Try to do some quick constant folding here.
  1190.          This will save save execution time of the compiler,
  1191.          as well time and space of the program if done here.  */
  1192.       if (GET_CODE (pattern) == SET
  1193.           && SET_DEST (pattern) == cc0_rtx)
  1194.         next = try_fold_cc0 (insn);
  1195.  
  1196.       if (next != 0)
  1197.         {
  1198.           used_const_equiv = 0;
  1199.           insn = next;
  1200.         }
  1201.       else
  1202.         {
  1203.           rtx note = find_reg_note (insn, REG_EQUIV, 0);
  1204.           copy = emit_insn (copy_rtx_and_substitute (pattern));
  1205.           if (! note_integrated (copy))
  1206.         {
  1207.           next = 0;
  1208.           goto retry;
  1209.         }
  1210.  
  1211.           /* If we are copying an insn that loads a constant,
  1212.          record the constantness.  */
  1213.           if (note)
  1214.         REG_NOTES (copy)
  1215.           = gen_rtx (EXPR_LIST, REG_EQUIV, XEXP (note, 0),
  1216.                  REG_NOTES (copy));
  1217.  
  1218.           if (GET_CODE (pattern) == SET
  1219.           && GET_CODE (SET_DEST (pattern)) == REG)
  1220.         {
  1221.           int regno = REGNO (SET_DEST (pattern));
  1222.  
  1223.           if (regno >= FIRST_PSEUDO_REGISTER
  1224.               && CONSTANT_P (SET_SRC (pattern))
  1225.               && (const_equiv_map[regno] == 0
  1226.               /* Following clause is a hack to make
  1227.                  case work where GNU C++ reassigns
  1228.                  a variable to make cse work right.  */
  1229.               || ! rtx_equal_p (const_equiv_map[regno],
  1230.                         SET_SRC (pattern))))
  1231.             {
  1232.               const_equiv_map[regno] = SET_SRC (pattern);
  1233.               const_age_map[regno] = const_age;
  1234.             }
  1235.         }
  1236.         }
  1237.       break;
  1238.  
  1239.     case JUMP_INSN:
  1240.       follows_call = 0;
  1241.       if (GET_CODE (PATTERN (insn)) == RETURN)
  1242.         {
  1243.           if (local_return_label == 0)
  1244.         local_return_label = gen_label_rtx ();
  1245.           emit_jump (local_return_label);
  1246.           break;
  1247.         }
  1248.       copy = emit_jump_insn (copy_rtx_and_substitute (PATTERN (insn)));
  1249.       if (! note_integrated (copy))
  1250.         {
  1251.           next = 0;
  1252.           goto retry;
  1253.         }
  1254.       break;
  1255.  
  1256.     case CALL_INSN:
  1257.       copy = emit_call_insn (copy_rtx_and_substitute (PATTERN (insn)));
  1258.       if (! note_integrated (copy))
  1259.         {
  1260.           next = 0;
  1261.           goto retry;
  1262.         }
  1263.       /* Special handling needed for the following INSN depending on
  1264.          whether it copies the value from the fcn return reg.  */
  1265.       if (GET_CODE (PATTERN (insn)) == SET)
  1266.         follows_call = SET_DEST (PATTERN (insn));
  1267.       else if (GET_CODE (PATTERN (insn)) == PARALLEL
  1268.            && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == SET)
  1269.         follows_call = SET_DEST (XVECEXP (PATTERN (insn), 0, 0));
  1270.       break;
  1271.  
  1272.     case CODE_LABEL:
  1273.       const_age += 2;
  1274.       copy = emit_label (label_map[CODE_LABEL_NUMBER (insn)]);
  1275.       follows_call = 0;
  1276.       if (const_age & 1)
  1277.         {
  1278.           int i;
  1279.  
  1280.           const_age += 1;
  1281.           for (i = max_regno; i >= 0; i--)
  1282.         if (const_age_map[i] == (unsigned)-1)
  1283.           const_age_map[i] = 0;
  1284.         }
  1285.       break;
  1286.  
  1287.     case BARRIER:
  1288.       const_age += 2;
  1289.       copy = emit_barrier ();
  1290.       break;
  1291.  
  1292.     case NOTE:
  1293.       /* It is important to discard function-end and function-beg notes,
  1294.          so we have only one of each in the current function.  */
  1295.       if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_END
  1296.           && NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_BEG)
  1297.         copy = emit_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn));
  1298.       else
  1299.         copy = 0;
  1300.       break;
  1301.  
  1302.     default:
  1303.       abort ();
  1304.       break;
  1305.     }
  1306.       if (! (used_const_equiv == 0))
  1307.     abort ();
  1308.       insn_map[INSN_UID (insn)] = copy;
  1309.     }
  1310.  
  1311.   if (local_return_label)
  1312.     emit_label (local_return_label);
  1313.  
  1314.   /* Don't try substituting constants when making up a DECLs rtl.
  1315.      That would probably only confuse the debugger, but I don't
  1316.      know for sure.  */
  1317.   try_use_const = 0;
  1318.   /* Make copies of the decls of the symbols in the inline function, so that
  1319.      the copies of the variables get declared in the current function.  */
  1320.   copy_decl_tree (DECL_INITIAL (fndecl), 0);
  1321.   /* For safety.  */
  1322.   if (try_use_const)
  1323.     used_const_equiv = 0;
  1324.  
  1325.   /* End the scope containing the copied formal parameter variables.  */
  1326.  
  1327.   expand_end_bindings (getdecls (), 1, 1);
  1328.   poplevel (1, 1, 0);
  1329.   poplevel (0, 0, 0);
  1330.  
  1331.   reg_map = NULL;
  1332.   label_map = NULL;
  1333.  
  1334.   const_equiv_map = old_const_equiv_map;
  1335.   const_age_map = old_const_age_map;
  1336.   const_age = old_const_age;
  1337.  
  1338.   if (ignore || TYPE_MODE (type) == VOIDmode)
  1339.     return 0;
  1340.  
  1341.   if (structure_value_addr)
  1342.     {
  1343.       if (target)
  1344.     return target;
  1345.       return gen_rtx (MEM, TYPE_MODE (type),
  1346.               memory_address (BLKmode, structure_value_addr));
  1347.     }
  1348.   else if (target && target != inline_target
  1349.        && (GET_CODE (inline_target) != SUBREG
  1350.            || SUBREG_REG (inline_target) != target))
  1351.     {
  1352.       /* Copy result back to TARGET if TARGET is not INLINE_TARGET.
  1353.          In general, these should always wind up being the same mode,
  1354.      after SUBREGs, if any, are stripped.  */
  1355.       convert_move (target, inline_target, 0);
  1356.     }
  1357.  
  1358.   return target;
  1359. }
  1360.  
  1361. /* Given a chain of PARM_DECLs, ARGS, and a vector of RTL homes VEC,
  1362.    copy each decl into a VAR_DECL, push all of those decls
  1363.    and give each one the corresponding home.  */
  1364.  
  1365. static void
  1366. copy_parm_decls (args, vec)
  1367.      tree args;
  1368.      rtx *vec;
  1369. {
  1370.   register tree tail;
  1371.   register int i;
  1372.  
  1373.   for (tail = args, i = 0; tail; tail = TREE_CHAIN (tail), i++)
  1374.     {
  1375.       register tree decl = pushdecl (build_decl (VAR_DECL, DECL_NAME (tail),
  1376.                          TREE_TYPE (tail)));
  1377.       /* These args would always appear unused, if not for this.  */
  1378.       TREE_USED (decl) = 1;
  1379.       DECL_RTL (decl) = vec[i];
  1380.     }
  1381. }
  1382.  
  1383. /* Given a LET_STMT node, push decls and levels
  1384.    so as to construct in the current function a tree of contexts
  1385.    isomorphic to the one that is given.  */
  1386.  
  1387. static void
  1388. copy_decl_tree (let, level)
  1389.      tree let;
  1390.      int level;
  1391. {
  1392.   tree t, node;
  1393.  
  1394.   pushlevel (0);
  1395.   
  1396.   for (t = STMT_VARS (let); t; t = TREE_CHAIN (t))
  1397.     {
  1398.       tree d = build_decl (TREE_CODE (t), DECL_NAME (t), TREE_TYPE (t));
  1399.       DECL_SOURCE_LINE (d) = DECL_SOURCE_LINE (t);
  1400.       DECL_SOURCE_FILE (d) = DECL_SOURCE_FILE (t);
  1401.       if (DECL_RTL (t) != 0)
  1402.     {
  1403.       if (GET_CODE (DECL_RTL (t)) == MEM
  1404.           && CONSTANT_ADDRESS_P (XEXP (DECL_RTL (t), 0)))
  1405.         /* copy_rtx_and_substitute would call memory_address
  1406.            which would copy the address into a register.
  1407.            Then debugging-output wouldn't know how to handle it.  */
  1408.         DECL_RTL (d) = DECL_RTL (t);
  1409.       else
  1410.         DECL_RTL (d) = copy_rtx_and_substitute (DECL_RTL (t));
  1411.     }
  1412.       TREE_EXTERNAL (d) = TREE_EXTERNAL (t);
  1413.       TREE_STATIC (d) = TREE_STATIC (t);
  1414.       TREE_PUBLIC (d) = TREE_PUBLIC (t);
  1415.       TREE_LITERAL (d) = TREE_LITERAL (t);
  1416.       TREE_ADDRESSABLE (d) = TREE_ADDRESSABLE (t);
  1417.       TREE_READONLY (d) = TREE_READONLY (t);
  1418.       TREE_VOLATILE (d) = TREE_VOLATILE (t);
  1419.       /* These args would always appear unused, if not for this.  */
  1420.       TREE_USED (d) = 1;
  1421.       pushdecl (d);
  1422.     }
  1423.  
  1424.   for (t = STMT_SUBBLOCKS (let); t; t = TREE_CHAIN (t))
  1425.     copy_decl_tree (t, level + 1);
  1426.  
  1427.   node = poplevel (level > 0, 0, 0);
  1428.   if (node)
  1429.     TREE_USED (node) = TREE_USED (let);
  1430. }
  1431.  
  1432. /* Create a new copy of an rtx.
  1433.    Recursively copies the operands of the rtx,
  1434.    except for those few rtx codes that are sharable.
  1435.  
  1436.    Handle constants that need to be placed in the constant pool by
  1437.    calling `force_const_mem'.  */
  1438.  
  1439. static rtx
  1440. copy_rtx_and_substitute (orig)
  1441.      register rtx orig;
  1442. {
  1443.   register rtx copy, temp;
  1444.   register int i, j;
  1445.   register RTX_CODE code;
  1446.   register enum machine_mode mode;
  1447.   register char *format_ptr;
  1448.   int regno;
  1449.  
  1450.   if (orig == 0)
  1451.     return 0;
  1452.  
  1453.   code = GET_CODE (orig);
  1454.   mode = GET_MODE (orig);
  1455.  
  1456.   switch (code)
  1457.     {
  1458.     case REG:
  1459.       /* If a frame-pointer register shows up, then we
  1460.      must `fix' the reference.  If the stack pointer
  1461.      register shows up, it must be part of stack-adjustments
  1462.      (*not* because we eliminated the frame pointer!).
  1463.      Small hard registers are returned as-is.  Pseudo-registers
  1464.      go through their `reg_map'.  */
  1465.       regno = REGNO (orig);
  1466.       if (regno < FIRST_PSEUDO_REGISTER)
  1467.     {
  1468.       /* Some hard registers are also mapped,
  1469.          but others are not translated.  */
  1470.       if (reg_map[regno] != 0)
  1471.         return reg_map[regno];
  1472.       if (REG_FUNCTION_VALUE_P (orig))
  1473.         {
  1474.           /* This is a reference to the function return value.  If
  1475.          the function doesn't have a return value, error.
  1476.          If it does, it may not be the same mode as `inline_target'
  1477.          because SUBREG is not required for hard regs.
  1478.          If not, adjust mode of inline_target to fit the context.  */
  1479.           if (inline_target == 0)
  1480.         {
  1481.           /* If there isn't an inline target, so be it.
  1482.              Just fake up a reg--it won't get used
  1483.              for anything important anyway.  */
  1484.           inline_target = gen_reg_rtx (mode);
  1485.           return inline_target;
  1486.         }
  1487.           if (mode == GET_MODE (inline_target))
  1488.         return inline_target;
  1489.           return gen_rtx (SUBREG, mode, inline_target, 0);
  1490.         }
  1491.       if (regno == FRAME_POINTER_REGNUM)
  1492.         return plus_constant (orig, fp_delta);
  1493.       return orig;
  1494.     }
  1495.       if (try_use_const
  1496.       && const_equiv_map[regno] != 0
  1497.       && const_age_map[regno] == (unsigned)-2)
  1498.     {
  1499.       used_const_equiv = 1;
  1500.       return const_equiv_map[regno];
  1501.     }
  1502.       if (reg_map[regno] == NULL)
  1503.     reg_map[regno] = gen_reg_rtx (mode);
  1504.       return reg_map[regno];
  1505.  
  1506.     case SUBREG:
  1507.       copy = copy_rtx_and_substitute (SUBREG_REG (orig));
  1508.       /* SUBREG is ordinary, but don't make nested SUBREGs.  */
  1509.       if (GET_CODE (copy) == SUBREG)
  1510.     return gen_rtx (SUBREG, GET_MODE (orig), SUBREG_REG (copy),
  1511.             SUBREG_WORD (orig) + SUBREG_WORD (copy));
  1512.       /* Don't build a SUBREG of a CONST_INT.  */
  1513.       if (GET_CODE (copy) == CONST_INT)
  1514.     return copy;
  1515.       return gen_rtx (SUBREG, GET_MODE (orig), copy,
  1516.               SUBREG_WORD (orig));
  1517.  
  1518.     case CODE_LABEL:
  1519.       return label_map[CODE_LABEL_NUMBER (orig)];
  1520.  
  1521.     case LABEL_REF:
  1522.       copy = rtx_alloc (LABEL_REF);
  1523.       PUT_MODE (copy, mode);
  1524.       XEXP (copy, 0) = label_map[CODE_LABEL_NUMBER (XEXP (orig, 0))];
  1525.       return copy;
  1526.  
  1527.     case PC:
  1528.     case CC0:
  1529.     case CONST_INT:
  1530.     case CONST_DOUBLE:
  1531.     case SYMBOL_REF:
  1532.       return orig;
  1533.  
  1534.     case CONST:
  1535.       /* Make new constant pool entry for a constant
  1536.      that was in the pool of the inline function.  */
  1537.       if (RTX_INTEGRATED_P (orig))
  1538.     return force_const_mem (GET_MODE (orig), XEXP (orig, 0));
  1539.       break;
  1540.  
  1541.     case ASM_OPERANDS:
  1542.       /* If a single asm insn contains multiple output operands
  1543.      then it contains multiple ASM_OPERANDS rtx's that share operand 3.
  1544.      We must make sure that the copied insn continues to share it.  */
  1545.       if (orig_asm_operands_vector == XVEC (orig, 3))
  1546.     {
  1547.       copy = rtx_alloc (ASM_OPERANDS);
  1548.       XSTR (copy, 0) = XSTR (orig, 0);
  1549.       XSTR (copy, 1) = XSTR (orig, 1);
  1550.       XINT (copy, 2) = XINT (orig, 2);
  1551.       XVEC (copy, 3) = copy_asm_operands_vector;
  1552.       XVEC (copy, 4) = copy_asm_constraints_vector;
  1553.       XSTR (copy, 5) = XSTR (orig, 5);
  1554.       XINT (copy, 6) = XINT (orig, 6);
  1555.       return copy;
  1556.     }
  1557.       break;
  1558.  
  1559.     case CALL:
  1560.       /* This is given special treatment because the first
  1561.      operand of a CALL is a (MEM ...) which may get
  1562.      forced into a register for cse.  This is undesirable
  1563.      if function-address cse isn't wanted or if we won't do cse.  */
  1564. #ifndef NO_FUNCTION_CSE
  1565.       if (! (optimize && ! flag_no_function_cse))
  1566. #endif
  1567.     return gen_rtx (CALL, GET_MODE (orig),
  1568.             gen_rtx (MEM, GET_MODE (XEXP (orig, 0)),
  1569.                  copy_rtx_and_substitute (XEXP (XEXP (orig, 0), 0))),
  1570.             copy_rtx_and_substitute (XEXP (orig, 1)));
  1571.       break;
  1572.  
  1573.     case PLUS:
  1574.       /* Note: treat the PLUS case as though it might be needed
  1575.          to be part of an address.  If it turns out that the machine's
  1576.      PLUS insns can handle something more exciting than a ``load
  1577.      effective address'', the optimizer will discover this fact.  */
  1578.       /* Take care of the easy case quickly.  */
  1579.       if (XEXP (orig, 0) == frame_pointer_rtx
  1580.       || (ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
  1581.           && XEXP (orig, 0) == arg_pointer_rtx))
  1582.     {
  1583.       rtx reg = XEXP (orig, 0), copy = XEXP (orig, 1);
  1584.  
  1585.       if (GET_CODE (copy) == CONST_INT)
  1586.         {
  1587.           int c = INTVAL (copy);
  1588.  
  1589.           if (reg == arg_pointer_rtx && c >= first_parm_offset)
  1590.         {
  1591.           copy = access_parm_map (c, VOIDmode);
  1592.           if (GET_CODE (copy) != MEM)
  1593.             /* Should not happen, because a parm we need to address
  1594.                should not be living in a register.
  1595.                (expand_inline_function copied it to a stack slot.)  */
  1596.             abort ();
  1597.           return XEXP (copy, 0);
  1598.         }
  1599.           return gen_rtx (PLUS, mode,
  1600.                   frame_pointer_rtx,
  1601.                   gen_rtx (CONST_INT, SImode,
  1602.                        c + fp_delta));
  1603.         }
  1604.       copy = copy_rtx_and_substitute (copy);
  1605.       temp = force_reg (mode, gen_rtx (PLUS, mode, frame_pointer_rtx, copy));
  1606.       return plus_constant (temp, fp_delta);
  1607.     }
  1608.       else if (reg_mentioned_p (frame_pointer_rtx, orig)
  1609.            || (ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
  1610.            && reg_mentioned_p (arg_pointer_rtx, orig)))
  1611.     {
  1612.       if (GET_CODE (XEXP (orig, 1)) == CONST_INT)
  1613.         {
  1614.           copy = copy_rtx_and_substitute (XEXP (orig, 0));
  1615.           temp = plus_constant (copy, INTVAL (XEXP (orig, 1)));
  1616.         }
  1617.       else
  1618.         {
  1619.           temp = gen_rtx (PLUS, GET_MODE (orig),
  1620.                   copy_rtx_and_substitute (XEXP (orig, 0)),
  1621.                   copy_rtx_and_substitute (XEXP (orig, 1)));
  1622.         }
  1623.       if (memory_address_p (mode, orig))
  1624.         temp = memory_address (mode, temp);
  1625.     }
  1626.       else
  1627.     {
  1628.       int old_used_const_equiv = used_const_equiv;
  1629.  
  1630.       used_const_equiv = 0;
  1631.       temp = gen_rtx (PLUS, GET_MODE (orig),
  1632.               copy_rtx_and_substitute (XEXP (orig, 0)),
  1633.               copy_rtx_and_substitute (XEXP (orig, 1)));
  1634.       if (used_const_equiv)
  1635.         {
  1636.           if (GET_CODE (XEXP (temp, 0)) == CONST_INT)
  1637.         temp = plus_constant (XEXP (temp, 1), INTVAL (XEXP (temp, 0)));
  1638.           else if (GET_CODE (XEXP (temp, 1)) == CONST_INT)
  1639.         temp = plus_constant (XEXP (temp, 0), INTVAL (XEXP (temp, 1)));
  1640.           else if (memory_address_p (mode, orig))
  1641.         {
  1642.           try_use_const = 0;
  1643.           used_const_equiv = 0;
  1644.           temp = gen_rtx (PLUS, GET_MODE (orig),
  1645.                   copy_rtx_and_substitute (XEXP (orig, 0)),
  1646.                   copy_rtx_and_substitute (XEXP (orig, 1)));
  1647.         }
  1648.         }
  1649.       else if (memory_address_p (mode, orig))
  1650.         temp = memory_address (mode, temp);
  1651.  
  1652.       used_const_equiv |= old_used_const_equiv;
  1653.     }
  1654.       return temp;
  1655.  
  1656.     case MULT:
  1657.       {
  1658.     int old_used_const_equiv = used_const_equiv;
  1659.  
  1660.     used_const_equiv = 0;
  1661.  
  1662.     temp = gen_rtx (MULT, GET_MODE (orig),
  1663.             copy_rtx_and_substitute (XEXP (orig, 0)),
  1664.             copy_rtx_and_substitute (XEXP (orig, 1)));
  1665.  
  1666.     if (used_const_equiv)
  1667.       {
  1668.         if (GET_CODE (XEXP (temp, 0)) == CONST_INT
  1669.         && GET_CODE (XEXP (temp, 1)) == CONST_INT)
  1670.           temp = gen_rtx (CONST_INT, VOIDmode,
  1671.                   INTVAL (XEXP (temp, 0)) * INTVAL (XEXP (temp, 1)));
  1672.         else
  1673.           {
  1674.         try_use_const = 0;
  1675.         used_const_equiv = 0;
  1676.         temp = gen_rtx (MULT, GET_MODE (orig),
  1677.                 copy_rtx_and_substitute (XEXP (orig, 0)),
  1678.                 copy_rtx_and_substitute (XEXP (orig, 1)));
  1679.           }
  1680.       }
  1681.     used_const_equiv |= old_used_const_equiv;
  1682.       }
  1683.       return temp;
  1684.  
  1685.     case MEM:
  1686.       /* Take care of easiest case here.  */
  1687.       copy = XEXP (orig, 0);
  1688.       if (copy == frame_pointer_rtx || copy == arg_pointer_rtx)
  1689.     return gen_rtx (MEM, mode,
  1690.             plus_constant (frame_pointer_rtx, fp_delta));
  1691.  
  1692.       /* Allow a pushing-address even if that is not valid as an
  1693.      ordinary memory address.  It indicates we are inlining a special
  1694.      push-insn.  These must be copied; otherwise unshare_all_rtl
  1695.      might clobber them to point at temporary rtl of this function.  */
  1696. #ifdef STACK_GROWS_DOWNWARD
  1697.       if (GET_CODE (copy) == PRE_DEC && XEXP (copy, 0) == stack_pointer_rtx)
  1698.     return gen_rtx (MEM, mode, copy_rtx_and_substitute (copy));
  1699. #else
  1700.       if (GET_CODE (copy) == PRE_INC && XEXP (copy, 0) == stack_pointer_rtx)
  1701.     return gen_rtx (MEM, mode, copy_rtx_and_substitute (copy));
  1702. #endif
  1703.  
  1704.       /* If this is some other sort of address that isn't generally valid,
  1705.      break out all the registers referred to.  */
  1706.       if (! memory_address_p (mode, copy))
  1707.     return gen_rtx (MEM, mode, copy_address (copy));
  1708.  
  1709.       /* There is no easy way to get our mode to `access_parm_map', which
  1710.      may need to know it, so here is most of the PLUS code duplicated.  */
  1711.       if (GET_CODE (copy) == PLUS)
  1712.     {
  1713.       if (XEXP (copy, 0) == frame_pointer_rtx
  1714.           || (ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
  1715.           && XEXP (copy, 0) == arg_pointer_rtx))
  1716.         {
  1717.           rtx reg;
  1718.           reg = XEXP (copy, 0), copy = XEXP (copy, 1);
  1719.  
  1720.           if (GET_CODE (copy) == CONST_INT)
  1721.         {
  1722.           int c = INTVAL (copy);
  1723.  
  1724.           if (reg == arg_pointer_rtx && c >= first_parm_offset)
  1725.             return access_parm_map (c, mode);
  1726.  
  1727.           temp = gen_rtx (PLUS, Pmode,
  1728.                   frame_pointer_rtx,
  1729.                   gen_rtx (CONST_INT, SImode,
  1730.                        c + fp_delta));
  1731.           if (! memory_address_p (Pmode, temp))
  1732.             {
  1733.               if (inline_fp_rtx == 0)
  1734.             {
  1735.               rtx last = get_last_insn ();
  1736.               inline_fp_rtx
  1737.                 = copy_to_mode_reg (Pmode,
  1738.                         plus_constant (frame_pointer_rtx, fp_delta));
  1739.               reorder_insns (NEXT_INSN (last), get_last_insn (), before_inline_fp_rtx);
  1740.             }
  1741.               return gen_rtx (MEM, mode, plus_constant (inline_fp_rtx, c));
  1742.             }
  1743.         }
  1744.           copy =  copy_rtx_and_substitute (copy);
  1745.           temp = gen_rtx (PLUS, Pmode, frame_pointer_rtx, copy);
  1746.           temp = plus_constant (temp, fp_delta);
  1747.           temp = memory_address (Pmode, temp);
  1748.         }
  1749.       else if (reg_mentioned_p (frame_pointer_rtx, copy)
  1750.            || (ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
  1751.                && reg_mentioned_p (arg_pointer_rtx, copy)))
  1752.         {
  1753.           if (GET_CODE (XEXP (copy, 1)) == CONST_INT)
  1754.         {
  1755.           temp = copy_rtx_and_substitute (XEXP (copy, 0));
  1756.           temp = plus_constant (temp, INTVAL (XEXP (copy, 1)));
  1757.         }
  1758.           else
  1759.         {
  1760.           temp = gen_rtx (PLUS, GET_MODE (copy),
  1761.                   copy_rtx_and_substitute (XEXP (copy, 0)),
  1762.                   copy_rtx_and_substitute (XEXP (copy, 1)));
  1763.         }
  1764.         }
  1765.       else
  1766.         {
  1767.           if (GET_CODE (XEXP (copy, 1)) == CONST_INT)
  1768.         temp = plus_constant (copy_rtx_and_substitute (XEXP (copy, 0)),
  1769.                       INTVAL (XEXP (copy, 1)));
  1770.           else
  1771.         {
  1772.           rtx left = copy_rtx_and_substitute (XEXP (copy, 0));
  1773.           rtx right = copy_rtx_and_substitute (XEXP (copy, 1));
  1774.  
  1775.           temp = gen_rtx (PLUS, GET_MODE (copy), left, right);
  1776.         }
  1777.         }
  1778.     }
  1779.       else
  1780.     temp = copy_rtx_and_substitute (copy);
  1781.  
  1782.       temp = change_address (orig, mode, temp);
  1783.       /* Deals with GCC bug for now.  */
  1784.       RTX_UNCHANGING_P (temp) = 0;
  1785.       return temp;
  1786.  
  1787.     case RETURN:
  1788.       abort ();
  1789.     }
  1790.  
  1791.   copy = rtx_alloc (code);
  1792.   PUT_MODE (copy, mode);
  1793.   copy->in_struct = orig->in_struct;
  1794.   copy->volatil = orig->volatil;
  1795.   copy->unchanging = orig->unchanging;
  1796.  
  1797.   format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
  1798.  
  1799.   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
  1800.     {
  1801.       switch (*format_ptr++)
  1802.     {
  1803.     case '0':
  1804.       break;
  1805.  
  1806.     case 'e':
  1807.       XEXP (copy, i) = copy_rtx_and_substitute (XEXP (orig, i));
  1808.       break;
  1809.  
  1810.     case 'u':
  1811.       /* Change any references to old-insns to point to the
  1812.          corresponding copied insns.  */
  1813.       XEXP (copy, i) = insn_map[INSN_UID (XEXP (orig, i))];
  1814.       break;
  1815.  
  1816.     case 'E':
  1817.       XVEC (copy, i) = XVEC (orig, i);
  1818.       if (XVEC (orig, i) != NULL && XVECLEN (orig, i) != 0)
  1819.         {
  1820.           XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
  1821.           for (j = 0; j < XVECLEN (copy, i); j++)
  1822.         XVECEXP (copy, i, j) = copy_rtx_and_substitute (XVECEXP (orig, i, j));
  1823.         }
  1824.       break;
  1825.  
  1826.     case 'i':
  1827.       XINT (copy, i) = XINT (orig, i);
  1828.       break;
  1829.  
  1830.     case 's':
  1831.       XSTR (copy, i) = XSTR (orig, i);
  1832.       break;
  1833.  
  1834.     default:
  1835.       abort ();
  1836.     }
  1837.     }
  1838.  
  1839.   if (code == ASM_OPERANDS && orig_asm_operands_vector == 0)
  1840.     {
  1841.       orig_asm_operands_vector = XVEC (orig, 3);
  1842.       copy_asm_operands_vector = XVEC (copy, 3);
  1843.       copy_asm_constraints_vector = XVEC (copy, 4);
  1844.     }
  1845.  
  1846.   return copy;
  1847. }
  1848.  
  1849. /* Get the value corresponding to an address relative to the arg pointer
  1850.    at index RELADDRESS.  MODE is the machine mode of the reference.
  1851.    MODE is used only when the value is a REG.
  1852.    Pass VOIDmode for MODE when the mode is not known;
  1853.    in such cases, you should make sure the value is a MEM.  */
  1854.  
  1855. static rtx
  1856. access_parm_map (reladdress, mode)
  1857.      int reladdress;
  1858.      enum machine_mode mode;
  1859. {
  1860.   /* Index in parm_map.  */
  1861.   int index = reladdress / UNITS_PER_WORD;
  1862.   /* Offset of the data being referenced
  1863.      from the beginning of the value for that parm.  */
  1864.   int offset = reladdress % UNITS_PER_WORD;
  1865.   rtx copy;
  1866.  
  1867.   /* If we are referring to the middle of a multiword parm,
  1868.      find the beginning of that parm.
  1869.      OFFSET gets the offset of the reference from
  1870.      the beginning of the parm.  */
  1871.  
  1872.   while (parm_map[index] == 0)
  1873.     {
  1874.       index--;
  1875.       if (index < first_parm_offset / UNITS_PER_WORD)
  1876.     /* If this abort happens, it means we need
  1877.        to handle "decrementing" INDEX back far
  1878.        enough to start looking among the reg parms
  1879.        instead of the stack parms.  What a mess!  */
  1880.     abort ();
  1881.       offset += UNITS_PER_WORD;
  1882.     }
  1883.  
  1884.   copy = parm_map[index];
  1885.  
  1886. #ifdef BYTES_BIG_ENDIAN
  1887.   /* Subtract from OFFSET the offset of where
  1888.      the actual (non-BLKmode) parm value would start.  */
  1889.   if (GET_MODE (copy) != BLKmode
  1890.       && GET_MODE_SIZE (GET_MODE (copy)) < UNITS_PER_WORD)
  1891.     offset
  1892.       -= (UNITS_PER_WORD
  1893.       - GET_MODE_SIZE (GET_MODE (copy)));
  1894. #endif
  1895.  
  1896.   /* For memory ref, adjust it by the desired offset.  */
  1897.   if (GET_CODE (copy) == MEM)
  1898.     {
  1899.       if (offset != 0 || GET_MODE (copy) != mode)
  1900.     return change_address (copy, mode,
  1901.                    plus_constant (XEXP (copy, 0),
  1902.                           offset));
  1903.       return copy;
  1904.     }
  1905.  
  1906.   if (GET_CODE (copy) != REG && GET_CODE (copy) != SUBREG
  1907.       && ! CONSTANT_P (copy))
  1908.     abort ();
  1909.   if (mode == VOIDmode)
  1910.     abort ();
  1911.  
  1912.   /* A REG cannot be offset by bytes, so use a subreg
  1913.      (which is possible only in certain cases).  */
  1914.   if (GET_MODE (copy) != mode
  1915.       && GET_MODE (copy) != VOIDmode)
  1916.     {
  1917.       int word;
  1918.       /* Crash if the portion of the arg wanted
  1919.      is not the least significant.
  1920.      Functions with refs to other parts of a
  1921.      parameter should not be inline--
  1922.      see function_cannot_inline_p. */
  1923. #ifdef BYTES_BIG_ENDIAN
  1924.       if (offset + GET_MODE_SIZE (mode)
  1925.       != GET_MODE_SIZE (GET_MODE (copy)))
  1926.     abort ();
  1927. #else
  1928.       if (offset != 0)
  1929.     abort ();
  1930. #endif
  1931.       word = 0;
  1932.       if (GET_CODE (copy) == SUBREG)
  1933.     word = SUBREG_WORD (copy), copy = SUBREG_REG (copy);
  1934.       if (CONSTANT_P (copy))
  1935.     copy = force_reg (GET_MODE (copy), copy);
  1936.       return gen_rtx (SUBREG, mode, copy, word);
  1937.     }
  1938.  
  1939.   return copy;
  1940. }
  1941.  
  1942. /* Like copy_rtx_and_substitute but produces different output, suitable
  1943.    for an ideosyncractic address that isn't memory_address_p.
  1944.    The output resembles the input except that REGs and MEMs are replaced
  1945.    with new psuedo registers.  All the "real work" is done in separate
  1946.    insns which set up the values of these new registers.  */
  1947.  
  1948. static rtx
  1949. copy_address (orig)
  1950.      register rtx orig;
  1951. {
  1952.   register rtx copy;
  1953.   register int i, j;
  1954.   register RTX_CODE code;
  1955.   register enum machine_mode mode;
  1956.   register char *format_ptr;
  1957.  
  1958.   if (orig == 0)
  1959.     return 0;
  1960.  
  1961.   code = GET_CODE (orig);
  1962.   mode = GET_MODE (orig);
  1963.  
  1964.   switch (code)
  1965.     {
  1966.     case REG:
  1967.       if (REGNO (orig) != FRAME_POINTER_REGNUM)
  1968.     return copy_rtx_and_substitute (orig);
  1969.       return plus_constant (frame_pointer_rtx, fp_delta);
  1970.  
  1971.     case PLUS:
  1972.       if (XEXP (orig, 0) == frame_pointer_rtx)
  1973.     return plus_constant (orig, fp_delta);
  1974.       break;
  1975.  
  1976.     case MEM:
  1977.       return copy_to_reg (copy_rtx_and_substitute (orig));
  1978.  
  1979.     case CODE_LABEL:
  1980.     case LABEL_REF:
  1981.       return copy_rtx_and_substitute (orig);
  1982.  
  1983.     case PC:
  1984.     case CC0:
  1985.     case CONST_INT:
  1986.     case CONST_DOUBLE:
  1987.     case SYMBOL_REF:
  1988.       return orig;
  1989.     }
  1990.  
  1991.   copy = rtx_alloc (code);
  1992.   PUT_MODE (copy, mode);
  1993.   copy->in_struct = orig->in_struct;
  1994.   copy->volatil = orig->volatil;
  1995.   copy->unchanging = orig->unchanging;
  1996.  
  1997.   format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
  1998.  
  1999.   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
  2000.     {
  2001.       switch (*format_ptr++)
  2002.     {
  2003.     case '0':
  2004.       break;
  2005.  
  2006.     case 'e':
  2007.       XEXP (copy, i) = copy_rtx_and_substitute (XEXP (orig, i));
  2008.       break;
  2009.  
  2010.     case 'u':
  2011.       /* Change any references to old-insns to point to the
  2012.          corresponding copied insns.  */
  2013.       XEXP (copy, i) = insn_map[INSN_UID (XEXP (orig, i))];
  2014.       break;
  2015.  
  2016.     case 'E':
  2017.       XVEC (copy, i) = XVEC (orig, i);
  2018.       if (XVEC (orig, i) != NULL && XVECLEN (orig, i) != 0)
  2019.         {
  2020.           XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
  2021.           for (j = 0; j < XVECLEN (copy, i); j++)
  2022.         XVECEXP (copy, i, j) = copy_rtx_and_substitute (XVECEXP (orig, i, j));
  2023.         }
  2024.       break;
  2025.  
  2026.     case 'i':
  2027.       XINT (copy, i) = XINT (orig, i);
  2028.       break;
  2029.  
  2030.     case 's':
  2031.       XSTR (copy, i) = XSTR (orig, i);
  2032.       break;
  2033.  
  2034.     default:
  2035.       abort ();
  2036.     }
  2037.     }
  2038.   return copy;
  2039. }
  2040.  
  2041. /* Return the constant equivalent of X.  If X is a manifest
  2042.    constant, it is returned.  If X is a register, we check
  2043.    to see if we happen to know its value as a constant.  */
  2044. static rtx
  2045. const_equiv (x)
  2046.      rtx x;
  2047. {
  2048.   if (GET_CODE (x) == REG)
  2049.     {
  2050.       int regno = REGNO (x);
  2051.       if (const_equiv_map[regno]
  2052.       && const_age_map[regno] >= const_age)
  2053.     return const_equiv_map[regno];
  2054.       return 0;
  2055.     }
  2056.   if (CONSTANT_P (x))
  2057.     return x;
  2058.   return 0;
  2059. }
  2060.  
  2061. /* Attempt to simplify INSN while copying it from an inline fn,
  2062.    assuming it is a SET that sets CC0.
  2063.  
  2064.    If we simplify it, we emit the appropriate insns and return
  2065.    the last insn that we have handled (since we may handle the insn
  2066.    that follows INSN as well as INSN itself).
  2067.  
  2068.    Otherwise we do nothing and return zero.  */
  2069.  
  2070. static rtx
  2071. try_fold_cc0 (insn)
  2072.      rtx insn;
  2073. {
  2074.   rtx cnst = copy_rtx_and_substitute (SET_SRC (PATTERN (insn)));
  2075.   rtx pat, copy;
  2076.  
  2077.   if (! CONSTANT_P (cnst))
  2078.     cnst = const_equiv (SET_SRC (PATTERN (insn)));
  2079.   if (cnst
  2080.       /* @@ Cautious: Don't know how many of these tests we need.  */
  2081.       && NEXT_INSN (insn)
  2082.       && GET_CODE (pat = PATTERN (NEXT_INSN (insn))) == SET
  2083.       && SET_DEST (pat) == pc_rtx
  2084.       && GET_CODE (pat = SET_SRC (pat)) == IF_THEN_ELSE
  2085.       && GET_RTX_LENGTH (GET_CODE (XEXP (pat, 0))) == 2)
  2086.     {
  2087.       rtx cnst2;
  2088.       rtx cond = XEXP (pat, 0);
  2089.  
  2090.       if ((XEXP (cond, 0) == cc0_rtx
  2091.        && (cnst2 = const_equiv (XEXP (cond, 1))))
  2092.       || (XEXP (cond, 1) == cc0_rtx
  2093.           && (cnst2 = const_equiv (XEXP (cond, 0)))))
  2094.     {
  2095.       copy = fold_out_const_cc0 (cond, XEXP (pat, 1), XEXP (pat, 2),
  2096.                      cnst, cnst2);
  2097.       if (copy)
  2098.         {
  2099.           if (GET_CODE (copy) == LABEL_REF)
  2100.         {
  2101.           /* We will branch unconditionally to
  2102.              the label specified by COPY.
  2103.              Eliminate dead code by running down the
  2104.              list of insn until we see a CODE_LABEL.
  2105.              If the CODE_LABEL is the one specified
  2106.              by COPY, we win, and can delete all code
  2107.              up to (but not necessarily including)
  2108.              that label.  Otherwise only win a little:
  2109.              emit the branch insn, and continue expanding.  */
  2110.           rtx tmp = NEXT_INSN (insn);
  2111.           while (tmp && GET_CODE (tmp) != CODE_LABEL)
  2112.             tmp = NEXT_INSN (tmp);
  2113.           if (! tmp)
  2114.             abort ();
  2115.           if (label_map[CODE_LABEL_NUMBER (tmp)] == XEXP (copy, 0))
  2116.             {
  2117.               /* Big win.  */
  2118.               return PREV_INSN (tmp);
  2119.             }
  2120.           else
  2121.             {
  2122.               /* Small win.  Emit the unconditional branch,
  2123.              followed by a BARRIER, so that jump optimization
  2124.              will know what to do.  */
  2125.               emit_jump (XEXP (copy, 0));
  2126.               return NEXT_INSN (insn);
  2127.             }
  2128.         }
  2129.           else if (copy == pc_rtx)
  2130.         {
  2131.           /* Do not take the branch, just fall through.
  2132.              Jump optimize should handle the elimination of
  2133.              dead code if appropriate.  */
  2134.           return NEXT_INSN (insn);
  2135.         }
  2136.           else
  2137.         abort ();
  2138.         }
  2139.     }
  2140.     }
  2141.   return 0;
  2142. }
  2143.  
  2144. /* If (COND_RTX CNST1 CNST2) yield a result we can treat
  2145.    as being constant, return THEN_RTX if the result is always
  2146.    non-zero, and return ELSE_RTX otherwise.  */
  2147. static rtx
  2148. fold_out_const_cc0 (cond_rtx, then_rtx, else_rtx, cnst1, cnst2)
  2149.      rtx cond_rtx, then_rtx, else_rtx;
  2150.      rtx cnst1, cnst2;
  2151. {
  2152.   int value1, value2;
  2153.   int int1 = GET_CODE (cnst1) == CONST_INT;
  2154.   int int2 = GET_CODE (cnst2) == CONST_INT;
  2155.   if (int1)
  2156.     value1 = INTVAL (cnst1);
  2157.   else
  2158.     value1 = 1;
  2159.   if (int2)
  2160.     value2 = INTVAL (cnst2);
  2161.   else
  2162.     value2 = 1;
  2163.  
  2164.   switch (GET_CODE (cond_rtx))
  2165.     {
  2166.     case NE:
  2167.       if (int1 && int2)
  2168.     if (value1 != value2)
  2169.       return copy_rtx_and_substitute (then_rtx);
  2170.     else
  2171.       return copy_rtx_and_substitute (else_rtx);
  2172.       if (value1 == 0 || value2 == 0)
  2173.     return copy_rtx_and_substitute (then_rtx);
  2174.       if (int1 == 0 && int2 == 0)
  2175.     if (rtx_equal_p (cnst1, cnst2))
  2176.       return copy_rtx_and_substitute (else_rtx);
  2177.       break;
  2178.     case EQ:
  2179.       if (int1 && int2)
  2180.     if (value1 == value2)
  2181.       return copy_rtx_and_substitute (then_rtx);
  2182.     else
  2183.       return copy_rtx_and_substitute (else_rtx);
  2184.       if (value1 == 0 || value2 == 0)
  2185.     return copy_rtx_and_substitute (else_rtx);
  2186.       if (int1 == 0 && int2 == 0)
  2187.     if (rtx_equal_p (cnst1, cnst2))
  2188.       return copy_rtx_and_substitute (then_rtx);
  2189.       break;
  2190.     case GE:
  2191.       if (int1 && int2)
  2192.     if (value1 >= value2)
  2193.       return copy_rtx_and_substitute (then_rtx);
  2194.     else
  2195.       return copy_rtx_and_substitute (else_rtx);
  2196.       if (value1 == 0)
  2197.     return copy_rtx_and_substitute (else_rtx);
  2198.       if (value2 == 0)
  2199.     return copy_rtx_and_substitute (then_rtx);
  2200.       break;
  2201.     case GT:
  2202.       if (int1 && int2)
  2203.     if (value1 > value2)
  2204.       return copy_rtx_and_substitute (then_rtx);
  2205.     else
  2206.       return copy_rtx_and_substitute (else_rtx);
  2207.       if (value1 == 0)
  2208.     return copy_rtx_and_substitute (else_rtx);
  2209.       if (value2 == 0)
  2210.     return copy_rtx_and_substitute (then_rtx);
  2211.       break;
  2212.     case LE:
  2213.       if (int1 && int2)
  2214.     if (value1 <= value2)
  2215.       return copy_rtx_and_substitute (then_rtx);
  2216.     else
  2217.       return copy_rtx_and_substitute (else_rtx);
  2218.       if (value1 == 0)
  2219.     return copy_rtx_and_substitute (then_rtx);
  2220.       if (value2 == 0)
  2221.     return copy_rtx_and_substitute (else_rtx);
  2222.       break;
  2223.     case LT:
  2224.       if (int1 && int2)
  2225.     if (value1 < value2)
  2226.       return copy_rtx_and_substitute (then_rtx);
  2227.     else
  2228.       return copy_rtx_and_substitute (else_rtx);
  2229.       if (value1 == 0)
  2230.     return copy_rtx_and_substitute (then_rtx);
  2231.       if (value2 == 0)
  2232.     return copy_rtx_and_substitute (else_rtx);
  2233.       break;
  2234.     case GEU:
  2235.       if (int1 && int2)
  2236.     if ((unsigned)value1 >= (unsigned)value2)
  2237.       return copy_rtx_and_substitute (then_rtx);
  2238.     else
  2239.       return copy_rtx_and_substitute (else_rtx);
  2240.       if (value1 == 0)
  2241.     return copy_rtx_and_substitute (else_rtx);
  2242.       if (value2 == 0)
  2243.     return copy_rtx_and_substitute (then_rtx);
  2244.       break;
  2245.     case GTU:
  2246.       if (int1 && int2)
  2247.     if ((unsigned)value1 > (unsigned)value2)
  2248.       return copy_rtx_and_substitute (then_rtx);
  2249.     else
  2250.       return copy_rtx_and_substitute (else_rtx);
  2251.       if (value1 == 0)
  2252.     return copy_rtx_and_substitute (else_rtx);
  2253.       if (value2 == 0)
  2254.     return copy_rtx_and_substitute (then_rtx);
  2255.       break;
  2256.     case LEU:
  2257.       if (int1 && int2)
  2258.     if ((unsigned)value1 <= (unsigned)value2)
  2259.       return copy_rtx_and_substitute (then_rtx);
  2260.     else
  2261.       return copy_rtx_and_substitute (else_rtx);
  2262.       if (value1 == 0)
  2263.     return copy_rtx_and_substitute (then_rtx);
  2264.       if (value2 == 0)
  2265.     return copy_rtx_and_substitute (else_rtx);
  2266.       break;
  2267.     case LTU:
  2268.       if (int1 && int2)
  2269.     if ((unsigned)value1 < (unsigned)value2)
  2270.       return copy_rtx_and_substitute (then_rtx);
  2271.     else
  2272.       return copy_rtx_and_substitute (else_rtx);
  2273.       if (value1 == 0)
  2274.     return copy_rtx_and_substitute (then_rtx);
  2275.       if (value2 == 0)
  2276.     return copy_rtx_and_substitute (else_rtx);
  2277.       break;
  2278.     }
  2279.   /* Could not hack it.  */
  2280.   return 0;
  2281. }
  2282.  
  2283. /* If any CONST expressions with RTX_INTEGRATED_P are present in X,
  2284.    they should be in the constant pool.
  2285.    Run force_const_mem to put them there.  */
  2286.  
  2287. static void
  2288. restore_constants (x)
  2289.      rtx x;
  2290. {
  2291.   int i, j;
  2292.   char *fmt = GET_RTX_FORMAT (GET_CODE (x));
  2293.  
  2294.   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (x)); i++)
  2295.     {
  2296.       switch (*fmt++)
  2297.     {
  2298.     case 'E':
  2299.       for (j = 0; j < XVECLEN (x, i); j++)
  2300.         if (RTX_INTEGRATED_P (XVECEXP (x, i, j))
  2301.         && GET_CODE (XVECEXP (x, i, j)) == CONST)
  2302.         XVECEXP (x, i, j) = force_const_mem (GET_MODE (XVECEXP (x, i, j)),
  2303.                          XEXP (XVECEXP (x, i, j), 0));
  2304.       else
  2305.         restore_constants (XVECEXP (x, i, j));
  2306.       break;
  2307.  
  2308.     case 'e':
  2309.       if (RTX_INTEGRATED_P (XEXP (x, i))
  2310.           && GET_CODE (XEXP (x, i)) == CONST)
  2311.         XEXP (x, i) = force_const_mem (GET_MODE (XEXP (x, i)),
  2312.                        XEXP (XEXP (x, i), 0));
  2313.       else
  2314.         restore_constants (XEXP (x, i));
  2315.       break;
  2316.     }
  2317.     }
  2318. }
  2319.  
  2320. /* Output the assembly language code for the function FNDECL
  2321.    from its DECL_SAVED_INSNS.  Used for inline functions that are output
  2322.    at end of compilation instead of where they came in the source.  */
  2323.  
  2324. void
  2325. output_inline_function (fndecl)
  2326.      tree fndecl;
  2327. {
  2328.   rtx head = DECL_SAVED_INSNS (fndecl);
  2329.   rtx last;
  2330.   extern rtx stack_slot_list;
  2331.  
  2332.   temporary_allocation ();
  2333.  
  2334.   current_function_decl = fndecl;
  2335.  
  2336.   /* This call is only used to initialize global variables.  */
  2337.   init_function_start (fndecl);
  2338.  
  2339.   /* Set stack frame size.  */
  2340.   assign_stack_local (BLKmode, DECL_FRAME_SIZE (fndecl));
  2341.  
  2342.   restore_reg_data (FIRST_PARM_INSN (head));
  2343.  
  2344.   stack_slot_list = XEXP (head, 9);
  2345.  
  2346.   /* There is no need to output a return label again.  */
  2347.   return_label = 0;
  2348.   expand_function_end (DECL_SOURCE_FILE (fndecl), DECL_SOURCE_LINE (fndecl));
  2349.  
  2350. #if 0
  2351.   /* Find last insn and rebuild the constant pool.  */
  2352.   for (last = FIRST_PARM_INSN (head);
  2353.        NEXT_INSN (last); last = NEXT_INSN (last))
  2354.     {
  2355.       if (GET_CODE (last) == INSN || GET_CODE (last) == JUMP_INSN
  2356.       || GET_CODE (last) == CALL_INSN)
  2357.     restore_constants (PATTERN (last));
  2358.     }
  2359. #endif
  2360.  
  2361.   set_new_first_and_last_insn (FIRST_PARM_INSN (head), last);
  2362.  
  2363.   /* Compile this function all the way down to assembly code.  */
  2364.   rest_of_compilation (fndecl);
  2365.  
  2366.   current_function_decl = 0;
  2367.  
  2368.   permanent_allocation ();
  2369. }
  2370. #if 0
  2371.  
  2372. /* Hashing of rtxs so that we don't make duplicates.
  2373.    The entry point is `rtx_hash_canon'.  */
  2374.  
  2375. /* Each hash table slot is a bucket containing a chain
  2376.    of these structures.  */
  2377.  
  2378. struct rtx_hash
  2379. {
  2380.   struct rtx_hash *next;    /* Next structure in the bucket.  */
  2381.   int hashcode;            /* Hash code of this type.  */
  2382.   rtx x;            /* The rtx recorded here.  */
  2383. };
  2384.  
  2385. /* Now here is the hash table.  This works exactly the same way
  2386.    that types are hashed in tree.c, except this is for rtxs.  */
  2387.  
  2388. #define RTX_HASH_SIZE 199
  2389. struct rtx_hash *rtx_hash_table[RTX_HASH_SIZE];
  2390.  
  2391. /* Here is how primitive or already-canonicalized types' hash
  2392.    codes are made.  */
  2393. #define RTX_HASH(RTX) (RTX)
  2394.  
  2395. /* Look in the type hash table for a type isomorphic to RTX.
  2396.    If one is found, return it.  Otherwise return 0.  */
  2397.  
  2398. tree
  2399. rtx_hash_lookup (hashcode, x)
  2400.      int hashcode;
  2401.      tree x;
  2402. {
  2403.   register struct rtx_hash *h;
  2404.   for (h = rtx_hash_table[hashcode % RTX_HASH_SIZE]; h; h = h->next)
  2405.     if (h->hashcode == hashcode
  2406.     && GET_CODE (h->x) == GET_CODE (x)
  2407.     && GET_MODE (h->x) == GET_MODE (x)
  2408. #if 0
  2409.     && h->x->jump == x->jump
  2410.     && h->x->call == x->call
  2411.     && h->x->unchanging == x->unchanging
  2412.     && h->x->volatil == x->volatil
  2413.     && h->x->in_struct == x->in_struct
  2414.     && h->x->used == x->used
  2415.     && h->x->integrated == x->integrated
  2416. #endif
  2417.     )
  2418.       {
  2419.     int i, j;
  2420.     int len = GET_RTX_LENGTH (GET_CODE (x));
  2421.     char *fmt = GET_RTX_FORMAT (GET_CODE (x));
  2422.  
  2423.     for (i = 0; i < len; i++)
  2424.       switch (fmt[i])
  2425.         {
  2426.         case '0':
  2427.           break;
  2428.  
  2429.         case 'e':
  2430.         case 'u':
  2431.         case 's':
  2432.         case 'S':
  2433.           if (XEXP (h->x, i) != XEXP (x, i))
  2434.         goto no_dice;
  2435.           break;
  2436.  
  2437.         case 'E':
  2438.           if (XVECLEN (h->x, i) != XVECLEN (x, i))
  2439.         goto no_dice;
  2440.           for (j = 0; j < XVECLEN (x, i); j++)
  2441.         if (XVECEXP (h->x, i, j) != XVECEXP (x, i, j))
  2442.           goto no_dice;
  2443.           break;
  2444.  
  2445.         case 'i':
  2446.         case 'n':
  2447.           if (INTVAL (XEXP (h->x, i)) != INTVAL (XEXP (x, i)))
  2448.         goto no_dice;
  2449.  
  2450.         default:
  2451.           abort ();
  2452.         }
  2453.  
  2454.     /* Everything matched.  */
  2455.     return h->x;
  2456.  
  2457.     /* Try more.  */
  2458.       no_dice:
  2459.     ;
  2460.       }
  2461.  
  2462.   /* Nothing matched.  */
  2463.   return 0;
  2464. }
  2465.  
  2466. /* Add an entry to the rtx-hash-table
  2467.    for a type RTX whose hash code is HASHCODE.  */
  2468.  
  2469. void
  2470. rtx_hash_add (hashcode, x)
  2471.      int hashcode;
  2472.      tree x;
  2473. {
  2474.   register struct rtx_hash *h;
  2475.  
  2476.   h = (struct rtx_hash *) oballoc (sizeof (struct rtx_hash));
  2477.   h->hashcode = hashcode;
  2478.   h->x = x;
  2479.   h->next = rtx_hash_table[hashcode % RTX_HASH_SIZE];
  2480.   rtx_hash_table[hashcode % RTX_HASH_SIZE] = h;
  2481. }
  2482.  
  2483. /* Given RTX, and HASHCODE its hash code, return the canonical
  2484.    object for an identical rtx if one already exists.
  2485.    Otherwise, return RTX, and record it as the canonical object
  2486.    if it is a permanent object.
  2487.  
  2488.    To use this function, first create a rtx of the sort you want.
  2489.    Then compute its hash code from the fields of the rtx that
  2490.    make it different from other similar rtxs.
  2491.    Then call this function and use the value.
  2492.    This function frees the rtx you pass in if it is a duplicate.  */
  2493.  
  2494. /* Set to 1 to debug without canonicalization.  Never set by program.  */
  2495. int debug_no_rtx_hash = 0;
  2496.  
  2497. tree
  2498. rtx_hash_canon (hashcode, x)
  2499.      int hashcode;
  2500.      tree x;
  2501. {
  2502.   tree x1;
  2503.  
  2504.   if (debug_no_rtx_hash)
  2505.     return x;
  2506.  
  2507.   x1 = rtx_hash_lookup (hashcode, x);
  2508.   if (x1 != 0)
  2509.     {
  2510.       struct obstack *o = maybepermanent_obstack;
  2511.       obstack_free (o, x);
  2512.       return x1;
  2513.     }
  2514.  
  2515.   /* If this is a new type, record it for later reuse.  */
  2516.   rtx_hash_add (hashcode, x);
  2517.  
  2518.   return x;
  2519. }
  2520. #endif
  2521.